Quantcast

Signing Amazon Web Services API Requests in Python

I wanted to ping the “Amazon Product Advertising API” which now requires an HMAC signature, and the pyAWS library doesn’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 the method described here
# http://docs.amazonwebservices.com/AWSECommerceService/latest/DG/index.html?RequestAuthenticationArticle.html
#_______________________________________________________________________________
def getSignedUrl(accessKey, secretKey, params):
 
    #Step 0: add accessKey, Service, Timestamp, and Version to params
    params['AWSAccessKeyId'] = accessKey
    params['Service']        = 'AWSECommerceService'
 
    #Amazon adds hundredths of a second to the timestamp (always .000), so we do too.
    #(see http://associates-amazon.s3.amazonaws.com/signed-requests/helper/index.html)
    params['Timestamp']      = time.strftime("%Y-%m-%dT%H:%M:%S.000Z", time.gmtime())
    params['Version']        = '2009-03-31'
 
    #Step 1a: sort params
    paramsList = params.items()
    paramsList.sort()
 
    #Step 1b-d: create canonicalizedQueryString
    # This code comes from http://blog.umlungu.co.uk/blog/2009/jul/12/pyaws-adding-request-authentication/
    # and the resulting discussion
    canonicalizedQueryString = '&'.join(['%s=%s' % (k,urllib.quote(str(v))) for (k,v) in paramsList if v])
 
    #Step 2: create string to sign
    host          = 'ecs.amazonaws.com'
    requestUri    = '/onca/xml'
    stringToSign  = 'GET\n'
    stringToSign += host +'\n'
    stringToSign += requestUri+'\n'
    stringToSign += canonicalizedQueryString.encode('utf-8')
 
    #Step 3: create HMAC
    digest = hmac.new(secretKey, stringToSign, hashlib.sha256).digest()
 
    #Step 4: base64 the hmac
    sig = base64.b64encode(digest)
 
    #Step 5: append signature to query
    url  = 'http://' + host + requestUri + '?'
    url += canonicalizedQueryString + "&Signature=" + urllib.quote(sig)
 
    return url

Look what Zara got me!

How To Teach Physics To Your Dog

E-reader Taste Test

We’ve tried a bunch, but have yet to find one that is actually tasty.

Also, I started a new blog about the Archive.

Invasion of the Book Scanners

We’re on a roll scanning books, and are always running out of space for book scanners. I arrived at HQ today and found five book scanners that can been set up in the conference room over the weekend!

confroom

Mind Tricks: Ancient and Modern

My new favorite little book. It’s got all kinds of helpful funny things. One of the ideas is to map letters to numbers, then make up nonsense sentences to remember strings of numbers (combination lock?). Of course I used a unix command to come up with the most frequent initial letters in the english language. Then I massaged the results a little.

cut -c1 /usr/share/dict/words | tr "[:upper:]" "[:lower:]" | uniq -c | sort -nr

Here is the resulting map … let’s go memorize some long strings of numbers!!! oh wait … we have cell phones, nobody needs to remember anything any more :-)

0 s ero
1 u on
2 t wo
3 r ee
4 d oor
5 a live
6 m ix
7 h eaven
8 b ait
9 p ine

93 68 59 79 45 47
please remember milk, bread, and please help piggy drain all drinks hai!

Author Steven Saunders has an eccentric little consulting company but I found this paper ABOUT EMERGENCE an interesting Sunday read.

Caraka Samhita



Caraka Samhita, originally uploaded by tiki.robot.

look what finally arrived!! -shag

TCM book sale at Eastwind Books

Stopped in at Eastwind Books at Columbus & Stockton in SF the other day, and discovered to my delight an unannounced 30% off sale on all books in the store.  Normally a random bookstore sale would not be blog-worthy, but Eastwind is not merely a random bookstore.  They are like the Kinokuniya of Chinese bookstores, and have one of the best selections of Traditional Chinese Medicine texts of any retail bookstore in the U.S, along with a selection of Chinese philosophy, literature, and language texts.

Some gems that were still on the shelves as I was leaving were Bensky’s Formulas and Strategies, Chen’s Chinese Medical Herbology & Pharmacology, and the English version of the Commission E Monographs.  With the sale taken into account, all three were priced significantly below BookFinder prices…

The Bird Book

What would your ideal notebook look like?

Suppose you could design your own moleskine-esque notebook, where every page and the cover is fully customizable. What kind of pages and images would you include? Please leave your ideas in the comments!

Dr. Alexander Shulgin’s First Lab Notebook

Dr. Alexander Shulin’s first laboratory notebook has been scanned and put online.
p.jpg
If you want higher resolution images, check out the JPEG 2000 files here.

Alice Waters at Red Hill Books

May, Jess, and I went to hear Alice Waters speak at Red Hill Books. It was packed! Here is the view from the very back:

IMG_3775.JPG

Here is a strange thing with feathers, in a window display next door to Red Hill:
IMG_3776.JPG

It was cold night! Even Zara needed a scarf!
IMG_3785.JPG

What Will Libraries Look Like in the Future?

For the Open Content Alliance meeting two weeks ago, the conference room at the Internet Archive HQ was transformed into a prototype library that will soon be open to the public. Here are some pictures of what Brewster calls the Open Library.

When you enter, you are greeted with a sign that explains the library:

This is a prototype library of the future that has access to millions of books, videos, and audio items from thousands of libraries worldwide. This library fits into a small room but still can house music, videos, one of a kind or popular books, and a librarian. It has download capabilities for patrons with music players, e-books, audio books and storage devices, and a Print on Demand machine that can print and bind a book in ten minutes.

The purpose of the open library is to provide universal access to all published knowledge. By using digitizing equipment, computer storange, and the Internet, we can realize the dream of the Library of Alexandria.

IMG_1688.JPG

When you walk in, the first thing that grabs your attention is the Espresso Book Machine, which can print a book and bind a book in about ten minutes.

The EBM completely changes the physical structure of the library. Using the public access terminal in the library or your own laptop, you can order one of the 200,000+ books from the Internet Archive book collection. It takes about five minutes of preparation and another five minutes of printing, and then a perfect-bound book shoots out of the machine. Here is some video of the EBM in action.

Even though this prototype library is pysically quite small, it has a collection larger than 80% of the libraries in the US. The Internet Archive book collection is growing at a rapid pace (15,000 books a month and rising). Soon, this might be the largest library in the world, and you will be able to put one in every town!

IMG_1699.JPG

In the two pictures above, you can see the ingredients of the Library of the Future:

  • Librarian’s Desk
  • Ten Minute Press
  • A public internet terminal, for ordering books form other libraries, printing books out, and filling up your iPod/ebook reader.
  • One-of-a-Kind Books, including:
  • E-Book Readers, in this case, the OLPC
  • Banned Books
  • Foreign-language books
  • Local-interest and technology books
  • 78 rpm records, and other non-book material
  • A comfy chair

What do you think? Anything we should add to the prototype Open Library?

Pics from the Prelinger Library

We went to the Illuminated Corridor event, Prelinger on Prelinger, at the Prelinger Library last night. Lots of video art! Some pics:

linky to pics on flickr

Video of the Espresso Book Machine printing a book!

This is the first time I got the Espresso Book Machine to print and bind a book without human intervention! I happend to capture a video of Flatland being printed. Very cool!


(click play to start) (link to other sizes)

Video and Pics of the Espresso Book Machine

Here is a short video of a test run of the Open Content Alliance’s Espresso Book Machine, an automatic print-on-demand robot that makes perfect-bound paperback books. The Espresso Book Machine was created by On Demand Books.

This video was shot during configuration of the machine, so you can see the printing/binding process, but the book gets stuck and comes out mangled.. I’ll upload another video after the machine is set up..


(press play to start video) (link to other sizes)

IMG_0994.JPG

IMG_0995.JPG

IMG_0998.JPG

The Return of FRAY!

Today I was thinking about Fray, the old-school story-telling website from back in the day. Unfortunately, they went on hiatus a couple days ago, and and have definitely been missed. It’s odd that the same day that I decided to check up on Fray is the same day that they announce the return of Fray, as a printed quarterly publication! Submissions are being accepted until October 1, so get busy!

I hope they resurrect the Fray Day events as well. We went to Fray Day 7 in SF and got to hear Armistead Maupin read and Noe Venable sing. It was magic.

Update: OK, it’s not odd that Fray picked today to relaunch; today is their 11th anniversary. But it is weird that I picked today to randomly start think about Fray.. hmm…

Mule Bookmobile in Venezuela

You know how they have Camel Bookmobiles in Kenya? Well, in Venezuela they have Mule Bookmobiles! Bibilomu-u-u-u-las!!!

via BB.

Gangsta 2.0

I think definitely wins the award for Funniest Thug Parody of the Week.

Read A Book

Add to My Profile | More Videos

Link to Read a Book on MySpaceTV

Announcing the Open Library!

Announcing The Open Library!

What if there was a library which held every book? Not every book on sale, or every important book, or even every book in English, but simply every book—our planet’s cultural legacy.

First, the library must be on the Internet. No physical space could be as big or as universally accessible as a public web site. The site would be like Wikipedia—a public resource that anyone in any country could access and that others could rework into different formats.

Second, it must be grandly comprehensive. It would take catalog entries from every library and publisher and random Internet user who is willing to donate them. It would link to places where each book could be bought, borrowed, or downloaded. It would collect reviews and references and discussions and every other piece of data about the book it could get its hands on.

But most importantly, such a library must be fully open. Not simply “free to the people,” as the grand banner across the Carnegie Library of Pittsburgh proclaims, but a product of the people: letting them create and curate its catalog, contribute to its content, participate in its governance, and have full, free access to its data. In an era where library data and Internet databases are being run by money-seeking companies behind closed doors, it’s more important than ever to be open.

So let us do just that: let us build the Open Library.

From Aaron Swartz’s blog:

I thought of the smartest programmers and designers I knew and gave them a ring, sat down for coffee with them, threatened to fly out to their homes and knock on their doors. In the end, we got together an amazing group of people — all sworn to secrecy of course — and in the past few months we’ve put together what’s probably the biggest project I ever worked on.

So today I’m extraordinarily proud to announce the Open Library project. Our goal is to build the world’s greatest library, then put it up on the Internet free for all to use and edit. Books are the place you go when you have something you want to share with the world — our planet’s cultural legacy. And never has there been a bigger attempt to bring them all together.

Congrats Aaron and team!

First Edition Principia Discordia Recovered from JFK Assasination Archive

This is highly weird. In April 2006, a First Edition copy of the Principia Discordia was recovered from the John F. Kennedy Archives (see routing slip). Here is a bit of detail on how it was found:

I stumbled upon knowledge of the Dead SeePresident Scrolls purely by chance – a reference number on a scan of a copy of something I did not believe I was looking at: so much so that I passed over the title page of the first edition of the Principia Discordia (How The West Was Lost) many times before it dawned on me what it was before my eyes.

On that sheet was an Accession Number. And that number pointed to a secret which has lain hidden for over 30 years, trapped unseen in a musty, dusty vault in Maryland.

As luck would have it, the Rev. Karl Musser happened to be in the neighbourhood of that very vault, and willing to do me a favour, All Blessings Unto Him.

But how did these papers end up in the Assassination Archive in the first place?

In the late sixties, founding Discordian Kerry Thornley, who had been in the Marines with Oswald, found himself under the microscope of those investigating the Assassination of John F. Kennedy. Such Official Investigations generate a Paper Trail – evidence proffered is indexed and stored… preserved against the erosion of time. (Well, mostly…)

Tiki Road Trip

trtcoversmall.jpgWhat’s summer without a summer read and a little armchair travel. Apparently, this book has it all. Via Drawn

James Teitelbaum and Santa Monica Press are pleased to announce the June, 2007 release of Tiki Road Trip 2, the follow-up to James Teitelbaum’s hugely successful book, Tiki Road Trip (Santa Monica Press, 2003).

Tiki Road Trip is your best – and only – comprehensive travel guide for those seeking a south seas adventure in the big city, an island escape from the urban jungle, or the location of the nearest metropolitan luau. At 360 pages (compared to 280 in the old edition) and packed with new images, this edition of Tiki Road Trip is a huge leap forward from the previous edition, and is absolutely mandatory summer reading.

reCAPTCHA: stop spam and help digitize books

reCaptcha is a project by Prof. Luis van Ahn at CMU.

Over 60 million CAPTCHAs are solved every day by people around the world. reCAPTCHA channels this human effort into helping to digitize books from the Internet Archive. When you solve a reCAPTCHA, you help preserve literature by deciphering a word that was not readable by computers.

reCAPTCHA is a great project. I added the WordPress plugin to TikiRobot, which will hopefully reduce all the crap that Akismet fails to catch. If you haven’t seen Prof. van Ahn’s TechTalk on Human Computation, check it out. It’s very good!

His other projects are The ESP Game and PeekABoom.

Update: Here is a quote from Brewster:

“I think it’s a brilliant idea — using the Internet to correct OCR mistakes,” said Brewster Kahle, director of the Internet Archive, in a statement. “This is an example of why having open collections in the public domain is important. People are working together to build a good, open system.”

Me Read Book

mewritebook.jpg

I just finished reading this book called Me Write Book, It Bigfoot Memoir. I can’t say it’s very good. It’s okay….but, oh my god, I read *A BOOK*!! Seriously, I don’t remember the last one I read before this. In fact, this could be the first book I’ve read all year…and may be the only book I read all year (which is kind of sad because there aren’t very many words in it…and only a few coherent sentences).

Anyways, I’m posting it here because firstly, I need to gloat about having read *A BOOK*…and secondly, I’ve resolved to not keep books that I don’t absolutely love (no space)…so if anyone else wants it, lemme know and I’ll drop it in the mail or give it to you the next time I see you.

what to do with your old tshirts

99ways.gif 99 Ways to Cut, Sew, Trim, and Tie Your T-Shirt into Something Special is a neat little book filled with lots of ways to cut up and turn all those random tshirts you have lying in the nether corners of your dresser into something more interesting (since i go to lots of random nerdy tech events – i’ve got lots of random techy tshirts that definitely need some modifying)

Each tshirt project is illustrated with clear instructions – most don’t require anything but a pair of scissors, a pen, and a ruler…and most take between 5-15 minutes. The design on the left is especially good for all those tshirts with annoying logos on the back!

tshirts.jpg

Miranda July Book Tour

Miranda July has an absolutely brilliant website for her new book, No one belongs here more than you.

According to her stove, she will be in LA on May 15 and in SF on May 16 to promote her new book. We should go!

21.jpg

Older Posts »