Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- from urllib import parse
- from urllib.request import pathname2url
- from suds.client import Client
- from suds.transport.http import HttpAuthenticated
- sessionID = None
- client = None
- def initiate_conn(hostUrl, username, password):
- global sessionID
- global client
- host = hostUrl+'/soap'
- wsdl_file = parse.urljoin('file:', pathname2url(os.path.abspath("soap_bindings/hpna10_11_api.wsdl.soappy")))
- t = HttpAuthenticated(username=username, password=password)
- client = Client(wsdl_file, transport=t)
- client.set_options(location=host)
- request = client.factory.create('loginInputParms')
- request.username = username
- request.password = password
- authObject = client.service.login(request)
- sessionID = authObject.Text
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement