diff --git a/connector_walmart/components/api/walmart.py b/connector_walmart/components/api/walmart.py index d20bdf3f..4e89a9cf 100644 --- a/connector_walmart/components/api/walmart.py +++ b/connector_walmart/components/api/walmart.py @@ -389,12 +389,12 @@ class Orders(Resource): def acknowledge(self, id): url = self.url + '/%s/acknowledge' % id - return self.send_request(method='POST', url=url) + return self.connection.send_request(method='POST', url=url) def cancel(self, id, lines): url = self.url + '/%s/cancel' % id - return self.send_request( - method='POST', url=url, data=self.get_cancel_payload(lines)) + return self.connection.send_request( + method='POST', url=url, body=self.get_cancel_payload(lines)) def get_cancel_payload(self, lines): element = ElementMaker( diff --git a/connector_walmart/models/sale_order/common.py b/connector_walmart/models/sale_order/common.py index 6574e233..944778bb 100644 --- a/connector_walmart/models/sale_order/common.py +++ b/connector_walmart/models/sale_order/common.py @@ -172,7 +172,8 @@ class SaleOrderAdapter(Component): if not 'list' in orders_response: return [] - next = orders_response['list']['meta']['nextCursor'] + # 'meta' may not be there (though it is in the example on the API docs even when nextCursor is none) + next = orders_response.get('list', {}).get('meta', {}).get('nextCursor') if next: self.env[self._apply_on].with_delay().import_batch( self.backend_record,