Using the latest version of PRAW instead of the old reddit_api

pull/5/head
David Trail 12 years ago
parent c7611db12b
commit 896abd5a54

@ -3,16 +3,16 @@ Shreddit
Details
-----------
Uses the reddit_api over at https://github.com/mellort/reddit_api to do all the heavy lifting.
Uses the praw over at https://github.com/praw-dev/praw to do all the heavy lifting.
Usage
-----------
- Just run `./schreddit`
- You may want to check out the reddit_api, build it using `python setup.py build` and then copy the /reddit directory to this directory. The reason I don't provide it is that the reddit_api changes frequently and I don't want to include a static old version here. I also don't want to have a git repo in a git repo.
- You will need the `praw` Reddit Python library installed somewhere. I advise taking a read of https://github.com/praw-dev/praw#installation
Tit-bits
-----------
- If you fill in your user/passwd in your reddit_api then you won't be asked for login details when you run the program! Otherwise you'll be prompted every time.
- If you fill in your user/passwd in your reddit.cfg then you won't be asked for login details when you run the program! Otherwise you'll be prompted every time.
Cron examples
-----------

@ -1,6 +1,6 @@
#!/usr/bin/env python2
import reddit
import praw
import ConfigParser
from datetime import datetime, timedelta
@ -15,9 +15,15 @@ verbose = config.getboolean('main', 'verbose')
clear_vote = config.getboolean('main', 'clear_vote')
item = config.get('main', 'item')
r = reddit.Reddit(user_agent="Shreddit-PRAW")
# add user: <YourUsername> / pswd: <YourPassword> to the [reddit] config section
r.login()
_user = config.get('main', 'username')
_pass = config.get('main', 'password')
r = praw.Reddit(user_agent="Shreddit-PRAW 2.0")
if _user and _pass:
r.login(_user, _pass)
else:
r.login()
if verbose:
print "Logged in as %s" % r.user

@ -1,7 +1,10 @@
# User and password will be prompted for
# or can be edited in the reddit_api [reddit] section
[main]
# Login details for Reddit. Fill out if you don't wish
# to be prompted for a login every time you run Shreddit.
username =
password =
# How many hours of comments you want to keep
# 24 hours in a day,
# 168 hours in a week,

Loading…
Cancel
Save