reddit-mastodon-crossposter/reddit.py
2023-08-01 18:59:46 +02:00

25 lines
No EOL
625 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())