-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathShipStation_v1_NoCreds.py
More file actions
20 lines (17 loc) · 860 Bytes
/
Copy pathShipStation_v1_NoCreds.py
File metadata and controls
20 lines (17 loc) · 860 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import requests, json
def getShipStationHttpRequest(reference,params): #HTTP Request for ShipStation API. Returns a JSON formatted file.
url = ('https://ssapi.shipstation.com/' + str(reference) + '/')
params = ('?' + str(params))
headers = {'Authorization': 'Basic REMOVED'}
combinedURL = (''.join([url, params]))
r = requests.get(combinedURL, headers=headers)
r.raise_for_status()
return r;
def postShipStationHttpRequest(reference,params,payload): #HTTP Request for ShipStation API. Returns a JSON formatted file.
url = ('https://ssapi.shipstation.com/' + str(reference) + '/')
params = (str(params))
headers = {'Content-Type': 'application/json','Authorization': 'Basic REMOVED'}
combinedURL = (''.join([url, params]))
r = requests.post(combinedURL, data=json.dumps(payload), headers=headers)
r.raise_for_status()
return r;