import requests from lxml import etree def Obtain_Ticket(URL, HOST): GetTicket = """ ddembinski mond@y string """ headers = {'Host': HOST, 'Content-Type': 'application/soap+xml; charset=utf-8', 'Content-Length': 'length'} response = requests.post(url=URL, data=GetTicket, headers=headers).text # print(response) temp1 = response.split('') temp2 = temp1[1].split('') ticket = temp2[0] # print("got ticket: " + ticket) return ticket def Release_Ticket(ticket, URL, HOST): ReleaseTicket = """ """+ticket+"""" """ headers = {'Host': HOST, 'Content-Type': 'application/soap+xml; charset=utf-8', 'Content-Length': 'length'} response = requests.post(url=URL, data=ReleaseTicket, headers=headers).text # print("released ticket "+ticket) def Run_Report(ticket, URL, HOST): send = """ """+ticket+""" Orders Order ID Order Price """ headers = {'Host': HOST, 'Content-Type': 'application/soap+xml; charset=utf-8', 'Content-Length': 'length'} response = requests.post(url=URL, data=send, headers=headers).text print(response) def main(): URL = 'http://soprema.gli.us.com/Store/storefrontapi.asmx' HOST = 'soprema.gli.us.com' ticket = Obtain_Ticket(URL, HOST) Run_Report(ticket, URL, HOST) Release_Ticket(ticket, URL, HOST) main()