Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- import praw
- import time
- from datetime import date
- r = praw.Reddit(client_id='xxxxxxxxxx',
- client_secret='xxxxxxxxxx',
- password='xxxxxxxx',
- user_agent='Jerry Thomas Recipe Poster 0.2 /u/cwinthrop',
- username='xxxxxx')
- with open('recipetit.txt', 'r') as title:
- tit = title.read()
- title.close()
- with open('recipeing.txt', 'r') as ingredients:
- ing = ingredients.read()
- ingredients.close()
- with open('recipeins.txt', 'r') as instructions:
- ins = instructions.read()
- instructions.close()
- today = str(date.today())
- ptit = '[Recipe for the week of ' + today + '] ' + tit
- wtit = tit.replace(" ","_")
- btit = tit.rstrip()
- btit = '**' + btit
- btit = btit + '**\n'
- body = btit + '\n' + ing + ins + '*This recipe is provided by* [1001 Cocktails](http://www.1001cocktails.com) - *"Drink Better!"*'
- print(ptit)
- print(wtit)
- r.subreddit('alcohol').wiki.create(wtit, body, reason='Posted: ' + today)
- submission = r.subreddit('alcohol').submit(ptit, selftext=body, resubmit=True, send_replies=False)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement