Skip to content

Instantly share code, notes, and snippets.

Forked from patrickleweryharris/
Last active May 24, 2022 02:57
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Delete all saved posts and comments on your reddit account with PRAW.
Based on:
This version has argparse removed to remove the command line options and they
are instead set here inside of the script. This solved two problems for me:
1. Reddit usernames can start with a "-" and argparse does not like that.
2. No more password in your shell history
Needs Python 3+ and Praw 5.3.0
client_id and client_secret are created on reddit as a locally installed
script at
import praw
username = ""
password = ""
client_id = ""
client_secret = ""
def run_praw(client_id, client_secret, password, username):
print(client_id, client_secret, username)
user_agent = "/u/{} delete all saved entries".format(username)
r = praw.Reddit(client_id=client_id, client_secret=client_secret,
password=password, username=username,
saved =
for s in saved:
except AttributeError as err:
def main():
""" Run the program """
run_praw(client_id, client_secret, password, username)
if __name__ == "__main__":
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment