Blog of Jeff A blog about programming and random other things.

Pydisqus

Pydisqus is a simple python library for accessing the Disqus API. All methods that the web API provides are all identical for consistency. In addition to wrapping the web methods, pydisqus also provides a simple object property access method instead of accessing hashes (since ['key'] is annoying to type). The library was originally intended for Django, but can be used for anything you so choose.

Example (obviously the api keys are not real):

import pydisqus
response = pydisqus.get_forum_list(user_api_key='key') 

print response.code # prints the disqus API response. 'ok' is a successful
api call.
print response.message # prints the parsed json of all the forums. 

# we happen to know that this returns a list of forum objects.
#
which the response object parsed and placed into payload.
for forum in
response.payload:
    key = pydisqus.get_forum_api_key(user_api_key='key',
forum_id=forum)
    print forum.name, key
# identical to code above 

for forum in response.message:
    key =
pydisqus.get_forum_api_key(user_api_key='key', forum_id=forum['id']) 

print forum['name'], key

Download (I’ll submit it to pypi when I have some time).

  • Share/Bookmark
blog comments powered by Disqus

Recent Posts

Topics

Archives

Following

Links