26 lines
No EOL
626 B
Python
26 lines
No EOL
626 B
Python
"""Initialize PRAW"""
|
|
|
|
from os import getenv
|
|
|
|
import praw
|
|
from dotenv import load_dotenv
|
|
|
|
# ----- 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()) |