Skip to content

Instantly share code, notes, and snippets.

@whutch whutch/roll.py
Last active Jul 5, 2016

Embed
What would you like to do?
"""
Install:
sudo pip install praw
git clone https://github.com/PurelyApplied/roll_one_for_me
cd roll_one_for_me
wget https://gist.githubusercontent.com/whutch/418cd6a7d8048b3ec2bcdc13a59133c6/raw/roll.py
Example usage:
python roll.py https://www.reddit.com/r/BehindTheTables/comments/4pxgzh/villains/
"""
import sys
import praw
from roll_one import TableSource
USER_AGENT = "Generate an outcome for random tables, under the name " \
"/u/roll_one_for_me Written and maintained by /u/PurelyApplied"
reddit = praw.Reddit(user_agent=USER_AGENT)
link = sys.argv[1]
submission = reddit.get_submission(link)
table = TableSource(submission, submission.title)
results = table.roll()
print(results)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.