23 lines
595 B
Python
23 lines
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())
|