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

15May/09link

Disqus for Python

I'm working on my Django blog app (something Cal Henderson jokes about), but since I'm too lazy to write a decent commenting system, I've been building upon Disqus. I thought it would be nice to separate it from a Django Application, resulting in pydisqus.

This is licensed under the BSD License. As a warning, this hasn't been thoroughly tested yet. Although it’s been decently documented via comments.

Here’s an 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 it here (I’ll submit it to pypi when I have some time to test it through my Django App).

I haven’t finished the Disqus App for Django, so that’s not available.

  • Share/Bookmark
blog comments powered by Disqus

Recent Posts

Topics

Archives

Following

Links