Skip to content

Instantly share code, notes, and snippets.

@Aeon
Created August 26, 2016 08:34
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 Aeon/24096a2c75565714ee2a88bfcca51425 to your computer and use it in GitHub Desktop.
Save Aeon/24096a2c75565714ee2a88bfcca51425 to your computer and use it in GitHub Desktop.
reddit flair importer
  1. go to https://www.reddit.com/prefs/apps and create a new script app
  2. copy the client_id (short weird string next to app name) and client_secret (long weird string)
  3. insert your mod username, password, client_id and client_secret into praw.ini
  4. create flair.txt file with list of flairs
  5. install praw library with pip install --pre praw
  6. run python flair_import.py
from praw import Reddit
reddit = Reddit()
sub = reddit.subreddit('wingchun')
editable = False
css = ''
with open('flair.txt') as f:
flairs = f.read().splitlines()
sub.flair.templates.clear()
for text in flairs:
sub.flair.templates.add(text, css, editable)
[DEFAULT]
domain: www.reddit.com
ssl_domain: ssl.reddit.com
username: ...
password: ...
client_id: ...
client_secret: ...
user_agent: flairbot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment