reddit-mastodon-crossposter/reddit.py
2022-12-09 00:04:01 +01:00

23 lines
No EOL
595 B
Python

"""Initialize PRAW"""
import praw
from dotenv import load_dotenv
from os import getenv
# load .env
load_dotenv()
# initialize reddit
reddit = praw.Reddit(
client_id = getenv("REDDIT_CLIENT_ID"),
client_secret = getenv("REDDIT_CLIENT_SECRET"),
redirect_uri = "http://localhost:8080", # does not matter what is here
user_agent = getenv("REDDIT_USER_AGENT")
)
# get auth URL
# print(reddit.auth.url(scopes=["identity", "read"], state="...", duration="permanent"))
# get refresh token
# print(reddit.auth.authorize(getenv("REDDIT_AUTH_TOKEN")))
# print(reddit.user.me())