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))


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.


GPL version 2 for now.


Source code is available at github.com

Home page: http://github.com/jwatney/pyso
Repository: git://github.com/jwatney/pyso.git


Works with Python 2.6. Not sure about other versions.


Contact me at jonathonwatney at gmail dot com, or through the issue tracker at github if you have a bug or feature request.

  • Thanks guys. Feel free to leave a comment here if you end up using it or know someone who does. Oct 22, 2010 at 19:31
  • 2
    Link to the repo is dead now Jul 31, 2017 at 8:34

1 Answer 1


I like this library because I can look at it and easily understand what bit does what. It's not very "ergonomic" right now, however. I'd like to be able to write code like this...

#determine what bumped this question at the top of the homepage
top_questions_on_homepage = pyso.get_all_questions(order_by="activity")
question = top_questions_on_homepage.next()
                            start_date = question["last_activity_date"])

...but get_questions_timeline doesn't want a numeric ID, or a list of numeric IDs, but a semicolon separated string of IDs. The problem is kinda worse with start_date, because the library expects... er, something it can call int(time.mktime(value.timetuple())) on to get back exactly the start_date value I got from the API.

Food for thought.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .