updating url and headers due to getting a 403 from reddit

This commit is contained in:
2026-03-09 22:52:18 -05:00
parent 0b21c6dd46
commit ba70b77609
3 changed files with 14 additions and 3 deletions

View File

@@ -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,
)