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

HTTP Error 401: Not Authorized #1

Open
DEV-XiA opened this issue Sep 8, 2022 · 2 comments
Open

HTTP Error 401: Not Authorized #1

DEV-XiA opened this issue Sep 8, 2022 · 2 comments

Comments

@DEV-XiA
Copy link

DEV-XiA commented Sep 8, 2022

Thank you for your work! But need little help with it.

'urllib.error.HTTPError: HTTP Error 401: Not Authorized'

same key and id test good in node and js.

Looks something wrong with this 10 years old library...... maybe something wrong with python 3.10?

@InbalEl
Copy link

InbalEl commented Nov 27, 2022

Getting the same.
Seems to work just fine in node for me as well.
I think it has to be some change that was made to the functions being called in _generate_signature, but no idea what exactly. Have you managed to solve this?

--> Edit 1:

Just found the solution in one of the forks, change time parameter sent to _generate_signature to time.time().
Do I understand it? nope. But it works

Screenshot from 2022-11-27 17-23-08

--> Edit 2:
Now that I understand it, I added import calendar and changed it to:
signature = self._generate_signature(
path_with_params , verb, channel,int(calendar.timegm(req_time.timetuple()))
)

Seems more correct to be using the same variable as the one I'm using in x-tourcms-date header since the two should always match.

@paulslugocki
Copy link

Hi, TourCMS dev here.

Essentially Date (or x-tourcms-date) must match the date used to sign the request. From my limited Python knowledge this should be good. That said, do check #3 for an alternative, x-tourcms-date can be expressed as a unix timestamp.

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

3 participants