Added a script to post to Reddit + doc.
This commit is contained in:
@@ -16,19 +16,17 @@ def get_reddit_instance():
|
||||
client_id = os.getenv("REDDIT_CLIENT_ID")
|
||||
client_secret = os.getenv("REDDIT_CLIENT_SECRET")
|
||||
user_agent = os.getenv("REDDIT_USER_AGENT")
|
||||
username = os.getenv("REDDIT_USERNAME") # <-- Add your Reddit username to .env
|
||||
password = os.getenv("REDDIT_PASSWORD") # <-- Add your Reddit password to .env
|
||||
refresh_token = os.getenv("REDDIT_REFRESH_TOKEN")
|
||||
|
||||
if not all([client_id, client_secret, user_agent, username, password]):
|
||||
print("Error: Reddit API credentials (including username/password) not found in .env file.")
|
||||
if not all([client_id, client_secret, user_agent, refresh_token]):
|
||||
print("Error: Reddit API credentials (including REDDIT_REFRESH_TOKEN) must be set in .env file.")
|
||||
return None
|
||||
|
||||
return praw.Reddit(
|
||||
client_id=client_id,
|
||||
client_secret=client_secret,
|
||||
user_agent=user_agent,
|
||||
username=username,
|
||||
password=password
|
||||
refresh_token=refresh_token
|
||||
)
|
||||
|
||||
def find_latest_image(pattern):
|
||||
|
Reference in New Issue
Block a user