aws
Authenticate REST requests to the Amazon Product Advertising API using Python
SowaCS Consulting’s Amazon Web Service Query Signer. Download the file called awsquerysigner_py.zip
As of August 15, 2009 Amazon required all API queries to have a special authentication signature. SowaCS Consulting has published a simple Python class (Python library?) that does the dirty work to sign your REST calls to the Amazon Product Advertising API. The code is on the website but they also offer a query signing service.
Back Story:
I finally got the gumption to attempt to tie in some AWS (Amazon Web Services) things into some of the websites I’m running because I want the affiliate advertising to blend in with my pages in a cleaner fashion. Unfortunately Amazon made it a lot harder for chumps like me to make API calls because of their newly enforced requirements that all requests be signed with a special hash signature. Steps involved to sign an Amazon REST request
- Take query params, re-order them by byte-value and make them UTF-8.
- url encode each key-value query parameter
- replace any “+” and “~” characters in the strings with url encodings
- add a timestamp
- Build a text string to prepare for hashing
- Encode signature using HMAC and SHA256
- Send request, and receive REST response.
This process sounds easy, but I couldn’t figure it out. I wrestled with Amazon’s Product Advertising API Documentation but the examples mostly uninformative. Thankfully, I came across a helpful post in the developer forums that points to SowaCS consulting. Naturally when looking at the code theirs is much cleaner, more flexible and it actually works. It’s not superb code but it IS way better than anything I would ever write. I really ought to go back to school…
Recent blog posts
- Amazon S3 Website CNAME
- Button labels for checkout
- Insert html django contrib messages
- Twitter Bootstrap not working with LESS.js
- Javascript libs that offer basic subset of jquery features
- Building the donor-matic
- Playing with free Google Map alternatives.
- Some flows are not as complicated as they appear
- Form design crib sheet
- Script to get IE9 Windows Virtual PC images into Virtual Box