示例#1
0
 def get_quote(self, request):
     """ Get quote """
     url = self.api_url + "quote/"
     req = {"request": request}
     headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
     
     return api_call("post", url, data=json.dumps(req), headers=headers,
         verify_cert=self.verify_cert)
示例#2
0
 def get_token(self, code):
     """ Get token """
     
     url = self.api_url + 'access_token/'
     
     headers = {'Accept': 'text/plain'}
     data = {
         'grant_type': 'authorization_code',
         'client_id': self.client_id,
         'client_secret': self.client_secret,
         'code': code
         }
     
     return api_call("post", url, data=data, headers=headers,
         verify_cert=self.verify_cert)
示例#3
0
 def download_documents(self, order_id, token):
     """ Download documents """
     url = self.api_url + "orders/" + order_id + "/documents/"
     
     return api_call("get", url, token=token, verify_cert=self.verify_cert)
示例#4
0
 def track(self, tracking_number):
     """ Track """
     url = self.api_url + "track/" + tracking_number + "/"
     
     return api_call("get", url, verify_cert=self.verify_cert)