Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions walmart/walmart.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
from lxml import etree
from lxml.builder import E, ElementMaker

from .exceptions import WalmartAuthenticationError


def epoch_milliseconds(dt):
"Walmart accepts timestamps as epoch time in milliseconds"
Expand Down Expand Up @@ -114,12 +112,6 @@ def send_request(
response.raise_for_status()
except requests.exceptions.HTTPError:
if response.status_code == 401:
raise WalmartAuthenticationError((
"Invalid client_id or client_secret. Please verify "
"your credentials from https://developer.walmart."
"com/#/generateKey"
))
elif response.status_code == 400:
data = response.json()
if data["error"][0]["code"] == \
"INVALID_TOKEN.GMP_GATEWAY_API":
Expand Down Expand Up @@ -358,11 +350,11 @@ def all(self, **kwargs):

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(
return self.connection.send_request(
method='POST', url=url, data=self.get_cancel_payload(lines))

def get_cancel_payload(self, lines):
Expand Down