diff --git a/Guide.txt b/Guide.txt new file mode 100644 index 0000000000000000000000000000000000000000..d5ea98ff436856c8c6f2e8ee8a4bf1dcc54bdf3b --- /dev/null +++ b/Guide.txt @@ -0,0 +1,12 @@ +Guide: +http://pythonforengineers.com/build-a-reddit-bot-part-1/ + +To install Python 2.7: +https://www.python.org/downloads/release/python-2714/ + +To install pip: +https://pip.pypa.io/en/stable/installing/ +-> download get-pip.py + +To install praw, use the following command: +pip install praw \ No newline at end of file diff --git a/MyBot.py b/MyBot.py index 875e1aa7040a4d1903bd44c357fbb50043e550fd..fcf97a2563e8bf6d3621c751e8b08b8c5c2553cb 100644 --- a/MyBot.py +++ b/MyBot.py @@ -1,10 +1,12 @@ +#!/usr/bin/python import praw reddit = praw.Reddit('bot1') + subreddit = reddit.subreddit("learnpython") -for submission in subreddit.hot(limit=5): - print("Title: ", submission.title) +for submission in subreddit.hot(limit=2): + print("Title: ", submission.title) print("Text: ", submission.selftext) print("Score: ", submission.score) print("---------------------------------\n") \ No newline at end of file diff --git a/praw.ini b/praw.ini index d1f2653906da3c2e3e0f5678c20b44aeec5a0b9f..f86dbdacf1c26e83dea3035e15f753d461880270 100644 --- a/praw.ini +++ b/praw.ini @@ -17,3 +17,10 @@ reddit_url=https://www.reddit.com # The URL prefix for short URLs. short_url=https://redd.it + +[bot1] +client_id=1Vx7MiwBKAvqOA +client_secret=TWC1yH1t_9pYivUmDUw0vitO8d4 +password=P2.71828182i +username=IneffableApophasis +user_agent=PyEng Bot 0.1 \ No newline at end of file