daily pastebin goal
37%
SHARE
TWEET

Untitled

a guest Oct 16th, 2017 88 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # encoding=utf-8
  2. from requests.auth import HTTPBasicAuth  # or HTTPDigestAuth, or OAuth1, etc.
  3. from zeep import Client
  4. from zeep import helpers
  5. from zeep.transports import Transport
  6. import logging.config
  7.  
  8. logging.config.dictConfig({
  9.     'version': 1,
  10.     'formatters': {
  11.         'verbose': {
  12.             'format': '%(name)s: %(message)s'
  13.         }
  14.     },
  15.     'handlers': {
  16.         'console': {
  17.             'level': 'DEBUG',
  18.             'class': 'logging.StreamHandler',
  19.             'formatter': 'verbose',
  20.         },
  21.     },
  22.     'loggers': {
  23.         'zeep.transports': {
  24.             'level': 'DEBUG',
  25.             'propagate': True,
  26.             'handlers': ['console'],
  27.         },
  28.     }
  29. })
  30. wsdl = 'wsdl_url'
  31. user = 'login'
  32. password = 'password'
  33. my_transport = Transport(http_auth=HTTPBasicAuth(user, password))
  34. client = Client(
  35.     wsdl, transport=my_transport
  36. )
  37. result = client.service.FunctionName(...)
  38. print result
  39.    
  40. {
  41.  'schema': <Schema(location=None)>,
  42.  '_value_1': <Element {urn:schemas-microsoft-com:xml-diffgram- v1}diffgram at 0x104ec0098>
  43. }
  44.    
  45. self.response = ''
  46.    
  47. self.response = response
  48.    
  49. python setup.py install
  50.    
  51. print my_transport.response.content
  52.    
  53. from zeep import Client
  54.  
  55. wsdl = 'wsdl_url'
  56.  
  57. client = Client(wsdl)
  58.  
  59. with client.options(raw_response=True):
  60.     soap_result = client.service.function_name(...)
  61.  
  62. # Print out text from Requests response object returned    
  63. print soap_result.text
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top