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

Url encode path and sort parameters for canonical_request. #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dmarchewka
Copy link

AWS to calculate signature, uses URL encoded URL path. So in case URL contains any spacial chars, signature is not gonna match. Encoding URL before creating a request also doesn't work because then AWS will just URL encode it again adding more chars and changing signature. Another requirement for the valid signature is calculating it from sorted parameters.

@LuisJDomingo
Copy link

https://www.amazon.es/s?k=8436542858298&__mk_es_ES=%C3%85M%C3%85%C5%BD%C3%95%C3%91&ref=nb_sb_noss

this number 8436542858298 is the EAN

Try searching by EAN (EAN-13. A 13-digit number used to individually and unequivocally identify each product in every country in the world).

So, you can pass the URL through an f-string.

https://www.amazon.es/s?k={EAN}&__mk_es_ES=%C3%85M%C3%85%C5%BD%C3%95%C3%91&ref=nb_sb_noss

Keep in mind that not all EANs are on Amazon, but all items on Amazon do have an EAN.

it works for me

@dmarchewka
Copy link
Author

I am run here into a different case. I am trying to integrate with AWS SP-API, which allows managing catalogs on amazon. It allows to pass custom product IDs that they are mapped later on to proper ASIN/EAN. And as I described before I had problem with calculating proper signature because AWS on some stage encodes URL path and it turns e.g. % into %25 and calculates signature on that.

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

Successfully merging this pull request may close these issues.

None yet

2 participants