Advertisement
Guest User

Untitled

a guest
Mar 9th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.06 KB | None | 0 0
  1. # -*- encoding: utf-8 -*-
  2. import datetime
  3. from hashlib import sha1
  4. import zeep
  5. from zeep import xsd
  6. from pprint import pprint
  7.  
  8. SHOP_NAME = ""
  9. PANEL_LOGIN = ""
  10. PANEL_PASS = ""
  11.  
  12. def hash_password():
  13.     return sha1(datetime.datetime.today().strftime('%Y%m%d').encode('utf-8') + sha1(PANEL_PASS.encode('utf-8')).hexdigest().encode('utf-8')).hexdigest()
  14.  
  15. # print(str(hash_password()))
  16.  
  17. wsdl=('http://xxx.iai-shop.com/api/?gate=products/getDescriptions/64/soap/wsdl&lang=pol')
  18. client = zeep.Client(wsdl)
  19.  
  20. auth_type = client.get_type('ns0:authenticateType')
  21. auth = auth_type('michal', hash_password())
  22.  
  23. productsIdentsType_type = client.get_type('ns0:productsIdentsType')
  24.  
  25. pit_type = client.get_type('ns0:productIdentType')
  26. pit = (pit_type('id', 333233))
  27.  
  28. parms_type = client.get_type('ns0:paramsType')
  29. parms = parms_type(pit)
  30. req = {
  31.     'authenticate': auth,
  32.     'params': parms,
  33. }
  34. print(req)
  35.  
  36.  
  37. with client.options(raw_response=True):
  38.     res = client.service.getDescriptions(req)
  39.  
  40. # Print out text from Requests response object returned
  41. print(res.content)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement