Python Has Wrapped Itself Around Windows Azure

| by Abel Avram Follow 5 Followers on Nov 13, 2008. Estimated reading time: 1 minute |

A note to our readers: You asked so we have developed a set of features that allow you to reduce the noise: you can get email and web notifications for topics you are interested in. Learn more about our new features.

Sriram Krishnan, a Microsoft Program Manager, has written a Python wrapper for Windows Azure Data Storage. Python is one of the languages supported by Windows Azure.

According to Microsoft's Azure web site, Python is one of the tools and languages to be supported by Windows Azure:

Windows Azure is an open platform that will support both Microsoft and non-Microsoft languages and environments. Windows Azure welcomes third party tools and languages such as Eclipse, Ruby, PHP, and Python. ...

Millions of developers worldwide already use the .NET Framework and the Visual Studio development environment. Utilize those same skills to create cloud-enabled applications that can be written, tested, and deployed all from Visual Studio. In the near future developers will be able to deploy applications written on RubyOn Rails and Python as well.

Sriram has written a Windows Azure data storage wrapper in Python and has placed the code on GitHub. Storing/retrieving data is done as in the following example:

    for (container_name,etag, last_modified ) in  conn.list_containers():
        print container_name
        print etag
        print last_modified
    conn.create_container("testcontainer", False)
    conn.put_blob("testcontainer","test","Hello World!" )
    print conn.get_blob("testcontainer", "test")

Signing-in is done as in the next example:

def _get_auth_header(self, http_method, path, data, headers):
   # As documented at
   string_to_sign =""

#First element is the method
   string_to_sign += http_method + NEW_LINE

   #Second is the optional content MD5
   string_to_sign += NEW_LINE

   #content type - this should have been initialized atleast to a blank value
   if headers.has_key("content-type"):
    string_to_sign += headers["content-type"]
   string_to_sign += NEW_LINE

   # date - we don't need to add header here since the special date storage header
   # always exists in our implementation
   string_to_sign += NEW_LINE

   # Construct canonicalized storage headers.
   # TODO: Note that this doesn't implement parts of the spec -
   # combining header fields with same name,
   # unfolding long lines and trimming white spaces around the colon
   ms_headers =[header_key for header_key in headers.keys()
   if header_key.startswith(PREFIX_STORAGE_HEADER)]
   for header_key in ms_headers:
    string_to_sign += "%s:%s%s" % (header_key, headers[header_key], NEW_LINE)

   # Add canonicalized resource
   string_to_sign += "/" + self.account_name + path
   utf8_string_to_sign = unicode(string_to_sign).encode("utf-8")
   hmac_digest =,
   return base64.encodestring(hmac_digest).strip()

It looks like Microsoft's plans with Windows Azure surpass Google's offering. Currently, Google's App Engine is supporting just Phyton, but there are plans to support more languages in the future, according to Google.


Rate this Article

Adoption Stage

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Thanks! by Sriram Krishnan

Thanks for the post. To clarify, the second bit of the code is *inside* the client library. Normal users don't need to see it or write anything like it. I posted it to illustrate how signing can be done for users planning on writing client libraries for other languages.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

1 Discuss

Login to InfoQ to interact with what matters most to you.

Recover your password...


Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.


More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.


Stay up-to-date

Set up your notifications and don't miss out on content that matters to you