Skip to content

Instantly share code, notes, and snippets.

@aperson
Created September 20, 2013 19:05
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 aperson/6642287 to your computer and use it in GitHub Desktop.
Save aperson/6642287 to your computer and use it in GitHub Desktop.
This script will change the mode of a subreddit. First you either need to make a file named 'credentials' that is in the same directory as the script that has your login info and subreddit or you can just replace the info in the script directly. Just invoke the script with the subreddit mode as an argument (eg: `python3 change_subreddit_mode.py …
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import praw
try:
from credentials import * #NOQA
except:
USERNAME = 'username'
PASSWORD = 'password'
SUBREDDIT = 'subreddit'
def change_subreddit_mode(mode):
reddit = praw.Reddit("/r/{}'s subreddit mode switcher".format(SUBREDDIT)
reddit.login(USERNAME, PASSWORD)
subreddit = reddit.get_subreddit(SUBREDDIT)
r.update_settings(subreddit, content_options=mode)
if __name__ == '__main__':
_, mode = sys.argv
change_subreddit_mode(mode)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment