-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest_random_ua.py
More file actions
38 lines (29 loc) · 1.21 KB
/
Copy pathtest_random_ua.py
File metadata and controls
38 lines (29 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env python3
"""
Test script to verify random user agent functionality
"""
import sys
import os
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
from browser_fetch import fetch_site_posts
from ai_report_settings import CONFIG
from shared import g_cs
def test_random_user_agent():
"""Test that random user agent is working"""
print("Testing random user agent functionality...")
# Check if we have a random user agent cached (REDDIT_USER_AGENT)
if g_cs.has("REDDIT_USER_AGENT"):
cached_ua = g_cs.get("REDDIT_USER_AGENT")
print(f"Found cached random user agent: {cached_ua[:50]}...")
else:
print("No cached random user agent found")
# Test the config
venturebeat_config = CONFIG.CUSTOM_FETCH_CONFIG.get("venturebeat.com")
if venturebeat_config:
print(f"VentureBeat config has use_random_user_agent: {venturebeat_config.use_random_user_agent}")
reddit_config = CONFIG.CUSTOM_FETCH_CONFIG.get("reddit.com")
if reddit_config:
print(f"Reddit config has use_random_user_agent: {reddit_config.use_random_user_agent}")
print("✅ Random user agent configuration test completed!")
if __name__ == "__main__":
test_random_user_agent()