Created
September 20, 2013 19:05
-
-
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 …
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
#!/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