<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>TikiRobot! &#187; amazon</title>
	<atom:link href="http://www.tikirobot.net/wp/tag/amazon/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.tikirobot.net/wp</link>
	<description>Mai Tais and Blinky Lights, Ahoy!</description>
	<lastBuildDate>Wed, 01 Feb 2012 22:14:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Signing Amazon Web Services API Requests in Python</title>
		<link>http://www.tikirobot.net/wp/2010/01/24/signing-amazon-web-services-api-requests-in-python/</link>
		<comments>http://www.tikirobot.net/wp/2010/01/24/signing-amazon-web-services-api-requests-in-python/#comments</comments>
		<pubDate>Sun, 24 Jan 2010 18:33:09 +0000</pubDate>
		<dc:creator>rajbot</dc:creator>
				<category><![CDATA[amazon]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[archive]]></category>
		<category><![CDATA[books]]></category>
		<category><![CDATA[code code]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.tikirobot.net/wp/?p=2915</guid>
		<description><![CDATA[I wanted to ping the &#8220;Amazon Product Advertising API&#8221; which now requires an HMAC signature, and the pyAWS library doesn&#8217;t sign requests and is no longer maintained. Here is some Python code to create a signed request: # pyAWS no longer works with the AWS signed request requirement # Sign an AWS REST request using [...]]]></description>
			<content:encoded><![CDATA[<p>I wanted to ping the &#8220;Amazon Product Advertising API&#8221; which now requires an HMAC signature, and the pyAWS library doesn&#8217;t sign requests and is no longer maintained. Here is some Python code to create a signed request:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;"># pyAWS no longer works with the AWS signed request requirement</span>
<span style="color: #808080; font-style: italic;"># Sign an AWS REST request using the method described here</span>
<span style="color: #808080; font-style: italic;"># http://docs.amazonwebservices.com/AWSECommerceService/latest/DG/index.html?RequestAuthenticationArticle.html</span>
<span style="color: #808080; font-style: italic;">#_______________________________________________________________________________</span>
<span style="color: #ff7700;font-weight:bold;">def</span> getSignedUrl<span style="color: black;">&#40;</span>accessKey, secretKey, params<span style="color: black;">&#41;</span>:
&nbsp;
    <span style="color: #808080; font-style: italic;">#Step 0: add accessKey, Service, Timestamp, and Version to params</span>
    params<span style="color: black;">&#91;</span><span style="color: #483d8b;">'AWSAccessKeyId'</span><span style="color: black;">&#93;</span> = accessKey
    params<span style="color: black;">&#91;</span><span style="color: #483d8b;">'Service'</span><span style="color: black;">&#93;</span>        = <span style="color: #483d8b;">'AWSECommerceService'</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">#Amazon adds hundredths of a second to the timestamp (always .000), so we do too.</span>
    <span style="color: #808080; font-style: italic;">#(see http://associates-amazon.s3.amazonaws.com/signed-requests/helper/index.html)</span>
    params<span style="color: black;">&#91;</span><span style="color: #483d8b;">'Timestamp'</span><span style="color: black;">&#93;</span>      = <span style="color: #dc143c;">time</span>.<span style="color: black;">strftime</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;%Y-%m-%dT%H:%M:%S.000Z&quot;</span>, <span style="color: #dc143c;">time</span>.<span style="color: black;">gmtime</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
    params<span style="color: black;">&#91;</span><span style="color: #483d8b;">'Version'</span><span style="color: black;">&#93;</span>        = <span style="color: #483d8b;">'2009-03-31'</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">#Step 1a: sort params</span>
    paramsList = params.<span style="color: black;">items</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
    paramsList.<span style="color: black;">sort</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">#Step 1b-d: create canonicalizedQueryString</span>
    <span style="color: #808080; font-style: italic;"># This code comes from http://blog.umlungu.co.uk/blog/2009/jul/12/pyaws-adding-request-authentication/</span>
    <span style="color: #808080; font-style: italic;"># and the resulting discussion</span>
    canonicalizedQueryString = <span style="color: #483d8b;">'&amp;'</span>.<span style="color: black;">join</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'%s=%s'</span> <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span>k,<span style="color: #dc143c;">urllib</span>.<span style="color: black;">quote</span><span style="color: black;">&#40;</span><span style="color: #008000;">str</span><span style="color: black;">&#40;</span>v<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span> <span style="color: #ff7700;font-weight:bold;">for</span> <span style="color: black;">&#40;</span>k,v<span style="color: black;">&#41;</span> <span style="color: #ff7700;font-weight:bold;">in</span> paramsList <span style="color: #ff7700;font-weight:bold;">if</span> v<span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">#Step 2: create string to sign</span>
    host          = <span style="color: #483d8b;">'ecs.amazonaws.com'</span>
    requestUri    = <span style="color: #483d8b;">'/onca/xml'</span>
    stringToSign  = <span style="color: #483d8b;">'GET<span style="color: #000099; font-weight: bold;">\n</span>'</span>
    stringToSign += host +<span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\n</span>'</span>
    stringToSign += requestUri+<span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\n</span>'</span>
    stringToSign += canonicalizedQueryString.<span style="color: black;">encode</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'utf-8'</span><span style="color: black;">&#41;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">#Step 3: create HMAC</span>
    digest = <span style="color: #dc143c;">hmac</span>.<span style="color: #dc143c;">new</span><span style="color: black;">&#40;</span>secretKey, stringToSign, hashlib.<span style="color: black;">sha256</span><span style="color: black;">&#41;</span>.<span style="color: black;">digest</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">#Step 4: base64 the hmac</span>
    sig = <span style="color: #dc143c;">base64</span>.<span style="color: black;">b64encode</span><span style="color: black;">&#40;</span>digest<span style="color: black;">&#41;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">#Step 5: append signature to query</span>
    url  = <span style="color: #483d8b;">'http://'</span> + host + requestUri + <span style="color: #483d8b;">'?'</span>
    url += canonicalizedQueryString + <span style="color: #483d8b;">&quot;&amp;Signature=&quot;</span> + <span style="color: #dc143c;">urllib</span>.<span style="color: black;">quote</span><span style="color: black;">&#40;</span>sig<span style="color: black;">&#41;</span>
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">return</span> url</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.tikirobot.net/wp/2010/01/24/signing-amazon-web-services-api-requests-in-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>San Francisco Food Bank</title>
		<link>http://www.tikirobot.net/wp/2008/12/20/san-francisco-food-bank/</link>
		<comments>http://www.tikirobot.net/wp/2008/12/20/san-francisco-food-bank/#comments</comments>
		<pubDate>Sun, 21 Dec 2008 06:23:00 +0000</pubDate>
		<dc:creator>rajbot</dc:creator>
				<category><![CDATA[food]]></category>
		<category><![CDATA[san francisco]]></category>
		<category><![CDATA[amazon]]></category>
		<category><![CDATA[donation]]></category>

		<guid isPermaLink="false">http://www.tikirobot.net/wp/?p=2187</guid>
		<description><![CDATA[TikiRobot is donating $100 to the SF Food Bank this winter. They feed 132,000 people every year, and this year their dry good supplies are down 15%. If you are in town over the holidays, they need volunteers. Every time we get a check from Amazon for having their widget in our sidebar, we&#8217;re rounding [...]]]></description>
			<content:encoded><![CDATA[<p>TikiRobot is donating $100 to the <a href="http://www.sffoodbank.org/">SF Food Bank</a> this winter. They feed 132,000 people every year, and this year their dry good supplies are down 15%. If you are in town over the holidays, <a href="http://www.sffoodbank.org/volunteer/">they need volunteers</a>.</p>
<p>Every time we get a check from Amazon for having their widget in our sidebar, we&#8217;re rounding it up to $100 and donating to a worthy cause.</p>
<p><a href="http://www.flickr.com/photos/earlysound/2148794499/"><img src="http://farm3.static.flickr.com/2214/2148794499_48298a2074.jpg" width="500" height="375"></a><br />
<small>cc by-nc picture by <a href="http://www.flickr.com/photos/earlysound/">Veronica Belmont</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://www.tikirobot.net/wp/2008/12/20/san-francisco-food-bank/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WiiMe</title>
		<link>http://www.tikirobot.net/wp/2007/12/07/wiime/</link>
		<comments>http://www.tikirobot.net/wp/2007/12/07/wiime/#comments</comments>
		<pubDate>Fri, 07 Dec 2007 20:15:06 +0000</pubDate>
		<dc:creator>may</dc:creator>
				<category><![CDATA[amazon]]></category>
		<category><![CDATA[no code]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[wii]]></category>

		<guid isPermaLink="false">http://www.tikirobot.net/wp/2007/12/07/wiime/</guid>
		<description><![CDATA[They sent me 9 consecutive text messages this morning, alternating between &#8220;Wiis are in stock at Amazon! Grab one!&#8221; and &#8220;No Wiis available :-( they were up for 8 seconds.&#8221; I&#8217;d pretty much given up until the 9th msg came through and I got one! yay! I can&#8217;t believe that it&#8217;s been a year already [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://twitter.com/wiime"><img src='http://www.tikirobot.net/wp/wp-content/uploads/2007/12/wiime1.jpg' alt='wiime1.jpg' align="left" style="padding-right:10px;" /></a><br />
<a href="http://twitter.com/wiime">They sent me 9 consecutive text messages this morning</a>, alternating between &#8220;<em>Wiis are in stock at Amazon! Grab one!</em>&#8221; and &#8220;<em>No Wiis available :-( they were up for 8 seconds.</em>&#8221;  </p>
<p>I&#8217;d pretty much given up until the 9th msg came through and I got one! yay! I can&#8217;t believe that it&#8217;s been a year already and it&#8217;s *STILL* so hard to get a Wii on Amazon. Yes, I know it&#8217;s possible to get one at a store if you live in Missouri (or just not in the Bay Area)&#8230;or if you wait in line at Best Buy at the crack of dawn, but I really didn&#8217;t want to do that (cause I&#8217;m lazy).  I just wanted to get one online for the office and <a href="http://twitter.com/wiime">WiiMe</a> came through!  </p>
]]></content:encoded>
			<wfw:commentRss>http://www.tikirobot.net/wp/2007/12/07/wiime/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

