Created
July 2, 2018 01:59
-
-
Save Abrownn/e89994cee7f1c76289abb25935957cb7 to your computer and use it in GitHub Desktop.
Shows all current userflairs along with a username in "Username, Flair" format
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import praw | |
import LOGINCREDENTIALFILE | |
import csv | |
def botLogin(): | |
redditInstance = praw.Reddit(username = LOGINCREDENTIALFILE.username, | |
password = LOGINCREDENTIALFILE.password, | |
client_id = LOGINCREDENTIALFILE.clientID, | |
client_secret = LOGINCREDENTIALFILE.clientSecret, | |
user_agent = LOGINCREDENTIALFILE.userAgent) | |
return redditInstance | |
r = botLogin() | |
def exposeFlairs(r): | |
with open("flairs.csv",'a', newline = '') as flairs: | |
write = csv.writer(flairs, delimiter=',') | |
for flair in r.subreddit('SUBREDDITNAME').flair(limit=None): | |
name = flair['user'] | |
flairs = flair['flair_text'] | |
print(name) | |
print(flairs) | |
write.writerow([name, flairs]) | |
exit() | |
exposeFlairs(r) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment