narwal

Thin Python 2.7 wrapper for reddit's API
Download

narwal Ranking & Summary

Advertisement

  • Rating:
  • License:
  • ISC License
  • Price:
  • FREE
  • Publisher Name:
  • Larry Ng
  • Publisher web site:
  • https://github.com/larryng/

narwal Tags


narwal Description

narwal is a Python wrapper for reddit's API made to be simple, intuitive, and concise, i.e. pythonic.>>> import narwal>>> session = narwal.connect('narwal_bot', 'hunter2', user_agent="i'm a narw(h)al!")>>> frontpage = session.hot()>>> for link in frontpage: ... print link ... (3088) Words can not describe how much I love this pic of Obama and Clinton (1697) Rough day for a mom at the airport. (1370) I felt awful when this happened.>>> frontpage.upvote()< Response >>>> frontpage.comment('cool story bro')< Comment >See the docs at http://narwal.readthedocs.org/.Works with Python 2.7.InstallationTo install, just do the usual: pip install narwalExamplesStart a session:>>> import narwal>>> session = narwal.connect(user_agent='narwal demo')Start a logged in session:>>> session = narwal.connect('narwal_bot', 'password', user_agent='narwal demo')Get the front page:>>> page1 = session.hot()Get the next page:>>> page2 = page1.more()Get the fourth link's comments:>>> comments = page1.comments()Get the second link of r/test/top:>>> link = session.top('test')Submit a comment to it:>>> comment = link.comment('the narwhal ba--')Downvote the comment we just submitted:>>> comment.downvote()< Response >And reply to it:>>> comment.reply('NO! *slap*')< Comment >Check our inbox:>>> inbox = session.inbox()Read the first message:>>> print inboxlarryng: hi thereGet the sender's account info and submissions:>>> user = session.user(inbox.author)>>> user.submitted() >]Plus a whole lot more, since most of the reddit API has been implemented. See the API docs (or the source) for more features.Product's homepage


narwal Related Software