diff --git a/connector_walmart/components/api/walmart.py b/connector_walmart/components/api/walmart.py index 4e89a9cf..352d89ff 100644 --- a/connector_walmart/components/api/walmart.py +++ b/connector_walmart/components/api/walmart.py @@ -152,7 +152,7 @@ class Walmart(object): )) elif response.status_code == 400: data = response.json() - if data["error"][0]["code"] == \ + if data.get("error", [{}])[0].get("code", '') == \ "INVALID_TOKEN.GMP_GATEWAY_API": # Refresh the token as the current token has expired self.authenticate() diff --git a/connector_walmart/models/sale_order/common.py b/connector_walmart/models/sale_order/common.py index 944778bb..389820a9 100644 --- a/connector_walmart/models/sale_order/common.py +++ b/connector_walmart/models/sale_order/common.py @@ -4,6 +4,7 @@ import logging import odoo.addons.decimal_precision as dp +from urllib.parse import parse_qs from odoo import models, fields, api from odoo.addons.queue_job.job import job @@ -161,7 +162,8 @@ class SaleOrderAdapter(Component): :return: List """ if next_cursor: - arguments = {'nextCursor': next_cursor} + # next_cursor looks like '?somefield=xxx&blah=yyy' + arguments = parse_qs(next_cursor.strip('?')) else: arguments = {'createdStartDate': from_date.isoformat()}