Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
working ver
Browse files
app.py
CHANGED
@@ -1,7 +1,8 @@
|
|
1 |
import os
|
2 |
import praw
|
3 |
|
4 |
-
#
|
|
|
5 |
print("Initializing Reddit instance...")
|
6 |
|
7 |
client_id = os.getenv('CLIENT_ID')
|
@@ -10,7 +11,6 @@ user_agent = os.getenv('USER_AGENT')
|
|
10 |
username = os.getenv('REDDIT_USERNAME')
|
11 |
password = os.getenv('REDDIT_PASSWORD')
|
12 |
|
13 |
-
# Print out the values to ensure they are loaded (mask sensitive info)
|
14 |
print(f"Client ID: {client_id}")
|
15 |
print(f"Client Secret is set: {'Yes' if client_secret else 'No'}")
|
16 |
print(f"User Agent: {user_agent}")
|
@@ -33,12 +33,12 @@ try:
|
|
33 |
print("Reddit instance created successfully.")
|
34 |
except Exception as e:
|
35 |
print(f"Error creating Reddit instance: {e}")
|
36 |
-
exit(1)
|
37 |
|
38 |
def monitor_new_posts():
|
39 |
try:
|
40 |
print("Attempting to access subreddit...")
|
41 |
-
subreddit_name = 'politics'
|
42 |
subreddit = reddit.subreddit(subreddit_name)
|
43 |
print(f"Successfully accessed subreddit: {subreddit.display_name}")
|
44 |
except Exception as e:
|
|
|
1 |
import os
|
2 |
import praw
|
3 |
|
4 |
+
# working
|
5 |
+
|
6 |
print("Initializing Reddit instance...")
|
7 |
|
8 |
client_id = os.getenv('CLIENT_ID')
|
|
|
11 |
username = os.getenv('REDDIT_USERNAME')
|
12 |
password = os.getenv('REDDIT_PASSWORD')
|
13 |
|
|
|
14 |
print(f"Client ID: {client_id}")
|
15 |
print(f"Client Secret is set: {'Yes' if client_secret else 'No'}")
|
16 |
print(f"User Agent: {user_agent}")
|
|
|
33 |
print("Reddit instance created successfully.")
|
34 |
except Exception as e:
|
35 |
print(f"Error creating Reddit instance: {e}")
|
36 |
+
exit(1)
|
37 |
|
38 |
def monitor_new_posts():
|
39 |
try:
|
40 |
print("Attempting to access subreddit...")
|
41 |
+
subreddit_name = 'politics'
|
42 |
subreddit = reddit.subreddit(subreddit_name)
|
43 |
print(f"Successfully accessed subreddit: {subreddit.display_name}")
|
44 |
except Exception as e:
|