Skip to content

Instantly share code, notes, and snippets.

@whutch
Last active July 5, 2016 19:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save whutch/418cd6a7d8048b3ec2bcdc13a59133c6 to your computer and use it in GitHub Desktop.
Save whutch/418cd6a7d8048b3ec2bcdc13a59133c6 to your computer and use it in GitHub Desktop.
"""
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