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

incorrect padding error #10

Open
ebdavison opened this issue Apr 30, 2019 · 1 comment
Open

incorrect padding error #10

ebdavison opened this issue Apr 30, 2019 · 1 comment

Comments

@ebdavison
Copy link

Having trouble with decoding the tracking url:

>>> open_tracking_url = pytracking.get_open_tracking_url(
...     {'ASIN': 'B07CBTMPHS'}, base_open_tracking_url="https://example.com/see", include_webhook_url=False)
>>> open_tracking_url
'https://example.com/eyJtZXRhZGF0YSI6IHsiQVNJTiI6ICJCMDdDQlRNUEhTIn19'
>>> tracking_result = pytracking.get_open_tracking_result(open_tracking_url, base_open_tracking_url="https://example.com/see")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.6/site-packages/pytracking/tracking.py", line 380, in get_open_tracking_result
    encoded_url_path, request_data, is_open=True)
  File "/usr/local/lib/python3.6/site-packages/pytracking/tracking.py", line 180, in get_tracking_result
    encoded_url_path.encode(self.encoding)).decode(
  File "/usr/lib64/python3.6/base64.py", line 133, in urlsafe_b64decode
    return b64decode(s)
  File "/usr/lib64/python3.6/base64.py", line 87, in b64decode
    return binascii.a2b_base64(s)
binascii.Error: Incorrect padding
@tmountain
Copy link

You have to omit the first part of the URL (https://example.com/).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants