Quivara commited on
Commit
8a49862
Β·
verified Β·
1 Parent(s): 998a0fa

Update alisto_project/backend/ingest_reddit.py

Browse files
alisto_project/backend/ingest_reddit.py CHANGED
@@ -142,6 +142,7 @@ async def process_post(post):
142
  log(f"Processing Error: {e}")
143
 
144
  # 5. Main Loop (POLLING MODE)
 
145
  async def scrape_reddit():
146
  log("πŸ”Œ Connecting to Reddit API (Debug Mode)...")
147
 
@@ -157,10 +158,12 @@ async def scrape_reddit():
157
  password=os.getenv("REDDIT_PASSWORD")
158
  )
159
 
160
- # --- THE TRUTH CHECK ---
161
- # This tells us if the password actually worked
162
  log(f"🧐 DEBUG CHECK: Am I logged in as {os.getenv('REDDIT_USERNAME')}?")
163
- is_read_only = await reddit.read_only
 
 
 
164
  log(f"πŸ‘‰ IS READ ONLY MODE? {is_read_only}")
165
  # True = Password Failed (You are Anonymous -> BLOCKED)
166
  # False = Password Worked (You are Logged In)
@@ -182,7 +185,6 @@ async def scrape_reddit():
182
 
183
  except Exception as e:
184
  log(f"⚠️ Connection glitch: {e}")
185
- # If 403 happens, we know exactly why now based on the Read Only check
186
  await asyncio.sleep(120)
187
 
188
  await reddit.close()
 
142
  log(f"Processing Error: {e}")
143
 
144
  # 5. Main Loop (POLLING MODE)
145
+ # 5. Main Loop (DEBUG MODE)
146
  async def scrape_reddit():
147
  log("πŸ”Œ Connecting to Reddit API (Debug Mode)...")
148
 
 
158
  password=os.getenv("REDDIT_PASSWORD")
159
  )
160
 
161
+ # --- THE TRUTH CHECK (Fixed) ---
 
162
  log(f"🧐 DEBUG CHECK: Am I logged in as {os.getenv('REDDIT_USERNAME')}?")
163
+
164
+ # NO 'await' here. Just read the value directly.
165
+ is_read_only = reddit.read_only
166
+
167
  log(f"πŸ‘‰ IS READ ONLY MODE? {is_read_only}")
168
  # True = Password Failed (You are Anonymous -> BLOCKED)
169
  # False = Password Worked (You are Logged In)
 
185
 
186
  except Exception as e:
187
  log(f"⚠️ Connection glitch: {e}")
 
188
  await asyncio.sleep(120)
189
 
190
  await reddit.close()