myelin: microsoft_com.py

This is an archive of a long-dead site; it was something I made as part of a prolific blogging and hacking spree from 2002-2003 or so. It's unlikely that any of it still works! I can't bear to delete it all though; this was an important time in my life. So... enjoy!

A Python wrapper for the Microsoft.com Platform Web Services

Use this script to access the Microsoft.com Platform Web Services from Python.

Installation

Download the ZIP file (below) and unzip it somewhere.

You may need to install PyXML before it will work.

You will need to get yourself a developer's token from Microsoft to get access to the service itself.

Read the comments at the start of microsoft_com.py for more information on how to get started.

Example

(after saving your token and PIN into mstoken.py ...)

import microsoft_com

print "Version:", microsoft_com.GetVersion()
print "Cultures:"
cultures = microsoft_com.GetCultures()
for culture in cultures:
    print "* ",culture
cultureid = cultures[0].CultureID
print "20 most popular downloads for:", cultureid
tops = microsoft_com.GetTopDownloads('Popular', 20, cultureid)
print tops
for top in tops:
    print "\nDetails for:", top.DownloadID
    print microsoft_com.GetDownloadDetail(top.DownloadID, cultureid)

Download

Latest version:

Thanks

The following publicly available code made life easier when hacking this together (this is included in the ZIP file):

BTW

There are no guarantees that this will actually work, or will continue to work, or that Microsoft's lawyers will like it. That said, it seems to work fine for me :-)

Bug reports, suggestions, and patches are welcome. (Contact me via the link below).

If you want to write your own client, you might want to look at Sam Ruby's minimal example, which gives a much clearer view of what the protocol looks like on the wire.