Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # encoding=utf-8
- from requests.auth import HTTPBasicAuth # or HTTPDigestAuth, or OAuth1, etc.
- from zeep import Client
- from zeep import helpers
- from zeep.transports import Transport
- import logging.config
- logging.config.dictConfig({
- 'version': 1,
- 'formatters': {
- 'verbose': {
- 'format': '%(name)s: %(message)s'
- }
- },
- 'handlers': {
- 'console': {
- 'level': 'DEBUG',
- 'class': 'logging.StreamHandler',
- 'formatter': 'verbose',
- },
- },
- 'loggers': {
- 'zeep.transports': {
- 'level': 'DEBUG',
- 'propagate': True,
- 'handlers': ['console'],
- },
- }
- })
- wsdl = 'wsdl_url'
- user = 'login'
- password = 'password'
- my_transport = Transport(http_auth=HTTPBasicAuth(user, password))
- client = Client(
- wsdl, transport=my_transport
- )
- result = client.service.FunctionName(...)
- print result
- {
- 'schema': <Schema(location=None)>,
- '_value_1': <Element {urn:schemas-microsoft-com:xml-diffgram- v1}diffgram at 0x104ec0098>
- }
- self.response = ''
- self.response = response
- python setup.py install
- print my_transport.response.content
- from zeep import Client
- wsdl = 'wsdl_url'
- client = Client(wsdl)
- with client.options(raw_response=True):
- soap_result = client.service.function_name(...)
- # Print out text from Requests response object returned
- print soap_result.text
Add Comment
Please, Sign In to add comment