Screenshot / Code Snippet
import pyso
# Install the Server Fault API version 1.0.
pyso.install_site(pyso.APISite("api.serverfault.com", "1.0"))
# Get all the names of the moderators.
print list((m["display_name"] for m in pyso.get_all_moderators()))
# Get question titles by user ID.
print list(q["title"] for q in pyso.get_users_questions(59180))
About
This is a simple Python module providing functions for querying Stack Overflow. I created it mostly because I was interested and because I wanted something small (it's not even 400 lines). It's simple; it works with Stack Overflow out of the box. Just import pyso
and start calling the functions. All results are Python dicts and/or lists, a straight deserialization provided by a json module. A generator is returned by functions that return multiple items.
All the functions are backed by a simple APISite class that does all the data fetching. To access another Stack Exchange site call install_site()
with a new APISite
instance created with the site API URL, e.g. "api.serverfault.com". Also, in cases where there isn't a pyso level function available this class can be used to make your a request. As well, there isn't a whole of error handling or documentation, so read the source.
License
GPL version 2 for now.
Download
Source code is available at github.com
Home page: http://github.com/jwatney/pyso
Repository: git://github.com/jwatney/pyso.git
Platform
Works with Python 2.6. Not sure about other versions.
Contact
Contact me at jonathonwatney at gmail dot com, or through the issue tracker at github if you have a bug or feature request.