22 lines
506 B
Python
22 lines
506 B
Python
import json
|
|
import requests
|
|
|
|
from django.conf import settings
|
|
|
|
from . import ShippingContainer
|
|
|
|
api_key = "Gj0MZRxvpJz2YbWaroKAjstYGPIHf738"
|
|
customer_id = "12375190"
|
|
headers = {'Authorization': 'RSIS ' + api_key, 'Content-Type': 'application/json'}
|
|
base_url = "https://xpsshipper.com/restapi/v1/customers/" + customer_id
|
|
|
|
|
|
def get_quote(weight):
|
|
resp = request("/quote", data)
|
|
|
|
|
|
def request(url, data):
|
|
r = requests.post(base_url + url, headers=headers, data=json.dumps(data))
|
|
return r.json()
|
|
|