feat: Add support for following redirects in httpx-based scraping

This commit is contained in:
Paul Gauthier (aider) 2024-09-21 18:46:21 -07:00
parent a77c8ccfa9
commit 3dfc63ce79

View file

@ -185,7 +185,7 @@ class Scraper:
headers = {"User-Agent": f"Mozilla./5.0 ({aider_user_agent})"}
try:
with httpx.Client(headers=headers, verify=self.verify_ssl) as client:
with httpx.Client(headers=headers, verify=self.verify_ssl, follow_redirects=True) as client:
response = client.get(url)
response.raise_for_status()
return response.text, response.headers.get("content-type", "").split(";")[0]