Skip to content

Commit 0ae8bd9

Browse files
committed
fix: ensure redirects are followed
1 parent 69a9bd6 commit 0ae8bd9

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

app/readers/canadacomputers.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
def get_price(url: str, client: httpx.Client) -> float:
1010
agent = random.choice(agents)
11-
r = client.get(url, headers={"User-Agent": agent}, timeout=10)
11+
r = client.get(url, headers={"User-Agent": agent}, timeout=10, follow_redirects=True)
1212
html = r.text
1313
pattern = r"price\"*\s*:\s*\"*(\d+\.\d+)"
1414
matches = re.findall(pattern, html)

app/readers/petvalu.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88

99
def get_price(url: str, client: httpx.Client) -> float:
10-
r = client.get(url, headers={"User-Agent": random.choice(agents)}, timeout=10)
10+
r = client.get(url, headers={"User-Agent": random.choice(agents)}, timeout=10, follow_redirects=True)
1111
html = r.text
1212
soup = BeautifulSoup(html, "html.parser")
1313
price = soup.find("div", {"class": "price"}).text

0 commit comments

Comments
 (0)