Basic AWIS (Alexa / Amazon Web Information Services) with Python’s boto

I wanted to use AWIS from Python. It’s surprisingly straight forward. Firstly, make sure you setup your boto config. Here is a simple example of how to create a connection, and run a query:

>>> import boto.connection
>>> conn = boto.connection.AWSQueryConnection(host='awis.amazonaws.com', is_secure=False)
>>> conn.APIVersion='2005-07-11'
>>> response = conn.make_request('UrlInfo', params={'Url':"http://youporn.com", 'ResponseGroup':'TrafficData'})
>>> # response is a httplib.HTTPResponse instance
>>> response.read() #Returns an XML response

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: