|
|
@ -1,5 +1,7 @@
|
|
|
|
import re
|
|
|
|
import re
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
from prawcore.exceptions import ResponseException
|
|
|
|
|
|
|
|
|
|
|
|
from utils import settings
|
|
|
|
from utils import settings
|
|
|
|
import praw
|
|
|
|
import praw
|
|
|
|
from praw.models import MoreComments
|
|
|
|
from praw.models import MoreComments
|
|
|
@ -29,6 +31,7 @@ def get_subreddit_threads(POST_ID: str):
|
|
|
|
username = settings.config["reddit"]["creds"]["username"]
|
|
|
|
username = settings.config["reddit"]["creds"]["username"]
|
|
|
|
if str(username).casefold().startswith("u/"):
|
|
|
|
if str(username).casefold().startswith("u/"):
|
|
|
|
username = username[2:]
|
|
|
|
username = username[2:]
|
|
|
|
|
|
|
|
try:
|
|
|
|
reddit = praw.Reddit(
|
|
|
|
reddit = praw.Reddit(
|
|
|
|
client_id=settings.config["reddit"]["creds"]["client_id"],
|
|
|
|
client_id=settings.config["reddit"]["creds"]["client_id"],
|
|
|
|
client_secret=settings.config["reddit"]["creds"]["client_secret"],
|
|
|
|
client_secret=settings.config["reddit"]["creds"]["client_secret"],
|
|
|
@ -37,6 +40,12 @@ def get_subreddit_threads(POST_ID: str):
|
|
|
|
passkey=passkey,
|
|
|
|
passkey=passkey,
|
|
|
|
check_for_async=False,
|
|
|
|
check_for_async=False,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
except ResponseException as e:
|
|
|
|
|
|
|
|
match e.response.status_code:
|
|
|
|
|
|
|
|
case 401:
|
|
|
|
|
|
|
|
print("Invalid credentials - please check them in config.toml")
|
|
|
|
|
|
|
|
except:
|
|
|
|
|
|
|
|
print("Something went wrong...")
|
|
|
|
|
|
|
|
|
|
|
|
# Ask user for subreddit input
|
|
|
|
# Ask user for subreddit input
|
|
|
|
print_step("Getting subreddit threads...")
|
|
|
|
print_step("Getting subreddit threads...")
|
|
|
|