Holy shit, it works. Kind of
This commit is contained in:
107
main.py
107
main.py
@@ -1,67 +1,64 @@
|
|||||||
import requests
|
import requests
|
||||||
from lxml import etree
|
from lxml import etree
|
||||||
|
|
||||||
from io import StringIO, BytesIO
|
def Obtain_Ticket():
|
||||||
|
GetTicket = """<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
|
||||||
|
<soap12:Body>
|
||||||
|
<ObtainUserTicket xmlns="http://www.pageflex.com/XmlWebServices/2004/StorefrontAPI/20041111">
|
||||||
|
<username>ddembinski</username>
|
||||||
|
<password>mond@y</password>
|
||||||
|
<ident>string</ident>
|
||||||
|
</ObtainUserTicket>
|
||||||
|
</soap12:Body>
|
||||||
|
</soap12:Envelope>"""
|
||||||
|
|
||||||
ticket = '40fb3d62-abfd-4476-b99f-75035aa1c0d'
|
headers = {'Host': 'soprema.gli.us.com', 'Content-Type': 'application/soap+xml; charset=utf-8', 'Content-Length': 'length'}
|
||||||
|
response = requests.post('http://soprema.gli.us.com/Store/storefrontapi.asmx', data=GetTicket, headers=headers).text
|
||||||
|
temp1 = response.split('<ObtainUserTicketResult>')
|
||||||
|
temp2 = temp1[1].split('</ObtainUserTicketResult>')
|
||||||
|
ticket = temp2[0]
|
||||||
|
# print("got ticket: " + ticket)
|
||||||
|
return ticket
|
||||||
|
|
||||||
test = """<?xml version="1.0" encoding="utf-8"?>
|
def Release_Ticket(ticket):
|
||||||
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
|
ReleaseTicket = """<?xml version="1.0" encoding="utf-8"?>
|
||||||
<soap12:Body>
|
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
|
||||||
<GetReport xmlns="http://www.pageflex.com/XmlWebServices/2004/StorefrontAPI/20041111">
|
<soap12:Body>
|
||||||
<token>"""+ticket+"""</token>
|
<ReleaseTicket xmlns="http://www.pageflex.com/XmlWebServices/2004/StorefrontAPI/20041111">
|
||||||
<reportName>Orders</reportName>
|
<ticket>"""+ticket+""""</ticket>
|
||||||
<columnNames>
|
</ReleaseTicket>
|
||||||
<string>Order ID</string>
|
</soap12:Body>
|
||||||
<string>Order Price</string>
|
</soap12:Envelope>"""
|
||||||
</columnNames>
|
headers = {'Host': 'soprema.gli.us.com', 'Content-Type': 'application/soap+xml; charset=utf-8', 'Content-Length': 'length'}
|
||||||
</GetReport>
|
|
||||||
</soap12:Body>
|
|
||||||
</soap12:Envelope>"""
|
|
||||||
send = """<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
|
|
||||||
<soap12:Body>
|
|
||||||
<GetReport xmlns="http://www.pageflex.com/XmlWebServices/2004/StorefrontAPI/20041111">
|
|
||||||
<token>40fb3d62-abfd-4476-b99f-75035aa1c0da</token>
|
|
||||||
<reportName>Orders</reportName>
|
|
||||||
<columnNames>
|
|
||||||
<string>Order ID</string>
|
|
||||||
<string>Order Price</string>
|
|
||||||
</columnNames>
|
|
||||||
</GetReport>
|
|
||||||
</soap12:Body>
|
|
||||||
</soap12:Envelope>"""
|
|
||||||
|
|
||||||
ObtainTicket = """<?xml version="1.0" encoding="utf-8"?>
|
response = requests.post('http://soprema.gli.us.com/Store/storefrontapi.asmx', data=ReleaseTicket, headers=headers).text
|
||||||
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
|
# print("released ticket "+ticket)
|
||||||
<soap12:Body>
|
|
||||||
<ObtainUserTicket xmlns="http://www.pageflex.com/XmlWebServices/2004/StorefrontAPI/20041111">
|
|
||||||
<username>ddembinski</username>
|
|
||||||
<password>mond@y</password>
|
|
||||||
<ident>string</ident>
|
|
||||||
</ObtainUserTicket>
|
|
||||||
</soap12:Body>
|
|
||||||
</soap12:Envelope>"""
|
|
||||||
|
|
||||||
ReleaseTicket = """<?xml version="1.0" encoding="utf-8"?>
|
def Run_Report(ticket):
|
||||||
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
|
|
||||||
<soap12:Body>
|
|
||||||
<ReleaseTicket xmlns="http://www.pageflex.com/XmlWebServices/2004/StorefrontAPI/20041111">
|
|
||||||
<ticket>fca51a05-d821-454c-9e5f-9aa19c94cf6f</ticket>
|
|
||||||
</ReleaseTicket>
|
|
||||||
</soap12:Body>
|
|
||||||
</soap12:Envelope>"""
|
|
||||||
|
|
||||||
headers = {'Host': 'soprema.gli.us.com', 'Content-Type': 'application/soap+xml; charset=utf-8', 'Content-Length': 'length'}
|
send = """<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
|
||||||
|
<soap12:Body>
|
||||||
|
<GetReport xmlns="http://www.pageflex.com/XmlWebServices/2004/StorefrontAPI/20041111">
|
||||||
|
<token>"""+ticket+"""</token>
|
||||||
|
<reportName>Orders</reportName>
|
||||||
|
<columnNames>
|
||||||
|
<string>Order ID</string>
|
||||||
|
<string>Order Price</string>
|
||||||
|
</columnNames>
|
||||||
|
</GetReport>
|
||||||
|
</soap12:Body>
|
||||||
|
</soap12:Envelope>"""
|
||||||
|
|
||||||
namespaces = {
|
headers = {'Host': 'soprema.gli.us.com', 'Content-Type': 'application/soap+xml; charset=utf-8', 'Content-Length': 'length'}
|
||||||
'soap': 'http://www.w3.org/2003/05/soap-envelope',
|
response = requests.post('http://soprema.gli.us.com/Store/storefrontapi.asmx', data=send, headers=headers).text
|
||||||
'a': 'http://www.pageflex.com/XmlWebServices/2004/StorefrontAPI/20041111'
|
print(response)
|
||||||
}
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
ticket = Obtain_Ticket()
|
||||||
|
Run_Report(ticket)
|
||||||
|
Release_Ticket(ticket)
|
||||||
|
|
||||||
response = requests.post('http://soprema.gli.us.com/Store/storefrontapi.asmx', data=ObtainTicket, headers=headers).text
|
main()
|
||||||
|
|
||||||
print(response)
|
|
||||||
xml = bytes(bytearray(response, encoding='utf-8'))
|
|
||||||
doc = etree.XML(xml)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user