pytracking
pytracking copied to clipboard
incorrect padding error
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
You have to omit the first part of the URL (https://example.com/).