Advertisement
Guest User

Untitled

a guest
May 2nd, 2017
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. import sys
  2. import praw
  3. import time
  4. from datetime import date
  5.  
  6. r = praw.Reddit(client_id='xxxxxxxxxx',
  7. client_secret='xxxxxxxxxx',
  8. password='xxxxxxxx',
  9. user_agent='Jerry Thomas Recipe Poster 0.2 /u/cwinthrop',
  10. username='xxxxxx')
  11.  
  12. with open('recipetit.txt', 'r') as title:
  13. tit = title.read()
  14. title.close()
  15.  
  16. with open('recipeing.txt', 'r') as ingredients:
  17. ing = ingredients.read()
  18. ingredients.close()
  19.  
  20. with open('recipeins.txt', 'r') as instructions:
  21. ins = instructions.read()
  22. instructions.close()
  23.  
  24. today = str(date.today())
  25.  
  26. ptit = '[Recipe for the week of ' + today + '] ' + tit
  27.  
  28. wtit = tit.replace(" ","_")
  29.  
  30. btit = tit.rstrip()
  31. btit = '**' + btit
  32. btit = btit + '**\n'
  33.  
  34. body = btit + '\n' + ing + ins + '*This recipe is provided by* [1001 Cocktails](http://www.1001cocktails.com) - *"Drink Better!"*'
  35.  
  36. print(ptit)
  37. print(wtit)
  38.  
  39. r.subreddit('alcohol').wiki.create(wtit, body, reason='Posted: ' + today)
  40.  
  41. submission = r.subreddit('alcohol').submit(ptit, selftext=body, resubmit=True, send_replies=False)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement