Take the 2-minute tour ×
Stack Apps is a question and answer site for apps, scripts, and development with the Stack Exchange API. It's 100% free, no registration required.

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.

share|improve this question
+1 This looks pretty amazing! –  Nathan Osman Oct 22 '10 at 3:59
+1 Good job ;).. –  systempuntoout Oct 22 '10 at 14:11
Thanks guys. Feel free to leave a comment here if you end up using it or know someone who does. –  Jonathon Watney Oct 22 '10 at 19:31

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.

share|improve this answer

You must log in to answer this question.

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