Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix Orders acknowledge and cancel #19

Open
wants to merge 22 commits into
base: develop
Choose a base branch
from
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