updating url and headers due to getting a 403 from reddit
This commit is contained in:
7
.claude/settings.local.json
Normal file
7
.claude/settings.local.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"permissions": {
|
||||
"allow": [
|
||||
"WebSearch"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ DATABASE_URL=postgresql+asyncpg://reddit:changeme@localhost:5432/reddit_monitor
|
||||
REDDIT_USER_AGENT=reddit-monitor:v1.0
|
||||
|
||||
# Subreddits to auto-add on first worker startup (comma-separated)
|
||||
SEED_SUBREDDITS=
|
||||
SEED_SUBREDDITS=mechanicalkeyboards,mnk,CustomKeyboards,BudgetKeebs,mechmarket,olkb,switchmodders,ErgoMechKeyboards,QMK,zmk,keycaps,keycapdesigners,ArtisanMacro,40PercentClub,60PercentClub,Keychron,HHKB,ModelM,Topre,WootingKB,Glorious,DuckyKeyboard,colemak,dvorak,KeyboardLayouts,MechanicalKeyboardsUK,MechanicalKeyboardsEU,mkindia,keyboards,EnthusiastKeyboards
|
||||
|
||||
# Daily digest generation hour (UTC, 0-23)
|
||||
DIGEST_HOUR_UTC=23
|
||||
|
||||
@@ -8,7 +8,7 @@ from backend.config import settings
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
BASE_URL = "https://www.reddit.com"
|
||||
BASE_URL = "https://old.reddit.com"
|
||||
|
||||
# Simple in-process rate limiter: track request timestamps
|
||||
_request_times: list[float] = []
|
||||
@@ -52,7 +52,11 @@ async def fetch_json(client: httpx.AsyncClient, path: str, params: dict | None =
|
||||
def create_client() -> httpx.AsyncClient:
|
||||
"""Create an httpx client configured for Reddit."""
|
||||
return httpx.AsyncClient(
|
||||
headers={"User-Agent": settings.reddit_user_agent},
|
||||
headers={
|
||||
"User-Agent": settings.reddit_user_agent,
|
||||
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
|
||||
"Accept-Language": "en-US,en;q=0.5",
|
||||
},
|
||||
timeout=30.0,
|
||||
follow_redirects=True,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user