Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
continue
rate_service = rate.service.lower()
if len(services) > 0 and rate_service not in services:
continue
if lowest_rate is None or float(rate.rate) < float(lowest_rate.rate):
lowest_rate = rate
if lowest_rate is None:
raise Error('No rates found.')
return lowest_rate
class Rate(CreateResource):
pass
class Refund(AllResource, CreateResource):
pass
class Batch(AllResource, CreateResource):
@classmethod
def create_and_buy(cls, api_key=None, **params):
requestor = Requestor(api_key)
url = "%s/%s" % (cls.class_url(), "create_and_buy")
wrapped_params = {cls.class_name(): params}
response, api_key = requestor.request('post', url, wrapped_params)
return convert_to_easypost_object(response, api_key)
def buy(self, **params):
requestor = Requestor(self._api_key)
url = "%s/%s" % (self.instance_url(), "buy")
response, api_key = requestor.request('post', url, params)
self.refresh_from(response, api_key)
return self
def cancel(self, **params):
requestor = Requestor(self._api_key)
url = "%s/%s" % (self.instance_url(), "cancel")
response, api_key = requestor.request('post', url, params)
self.refresh_from(response, api_key)
return self
class Order(AllResource, CreateResource):
def get_rates(self):
requestor = Requestor(self._api_key)
url = "%s/%s" % (self.instance_url(), "rates")
response, api_key = requestor.request('get', url)
self.refresh_from(response, api_key)
return self
def buy(self, **params):
requestor = Requestor(self._api_key)
url = "%s/%s" % (self.instance_url(), "buy")
response, api_key = requestor.request('post', url, params)
self.refresh_from(response, api_key)
return self
class PickupRate(Resource):
def add_shipments(self, **params):
requestor = Requestor(self._api_key)
url = "%s/%s" % (self.instance_url(), "add_shipments")
response, api_key = requestor.request('post', url, params)
self.refresh_from(response, api_key)
return self
def create_scan_form(self, **params):
requestor = Requestor(self._api_key)
url = "%s/%s" % (self.instance_url(), "scan_form")
response, api_key = requestor.request('post', url, params)
self.refresh_from(response, api_key)
return self
class PostageLabel(AllResource, CreateResource):
pass
class Tracker(AllResource, CreateResource):
@classmethod
def create_list(cls, api_key=None, **params):
requestor = Requestor(api_key)
url = "%s/%s" % (cls.class_url(), "create_list")
response, api_key = requestor.request('post', url, params)
return True
@classmethod
def all_updated(cls, api_key=None, **params):
requestor = Requestor(api_key)
url = "%s/%s" % (cls.class_url(), "all_updated")
response, api_key = requestor.request('get', url, params)
def create(cls, api_key=None, **params):
requestor = Requestor(api_key)
url = cls.class_url()
response, api_key = requestor.request('post', url, params)
return convert_to_easypost_object(response, api_key)
class Insurance(AllResource, CreateResource):
pass
class CustomsItem(AllResource, CreateResource):
pass
class CustomsInfo(AllResource, CreateResource):
pass
class Parcel(AllResource, CreateResource):
pass
class Shipment(AllResource, CreateResource):
@classmethod
def track_with_code(cls, api_key=None, **params):
requestor = Requestor(api_key)
url = "%s/%s" % (cls.class_url(), "track")
response, api_key = requestor.request('get', url, params)
return response
def get_rates(self):