Skip to content

Commit

Permalink
fix: ensure redirects are followed
Browse files Browse the repository at this point in the history
  • Loading branch information
builder555 committed Oct 29, 2024
1 parent 69a9bd6 commit 0ae8bd9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/readers/canadacomputers.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

def get_price(url: str, client: httpx.Client) -> float:
agent = random.choice(agents)
r = client.get(url, headers={"User-Agent": agent}, timeout=10)
r = client.get(url, headers={"User-Agent": agent}, timeout=10, follow_redirects=True)
html = r.text
pattern = r"price\"*\s*:\s*\"*(\d+\.\d+)"
matches = re.findall(pattern, html)
Expand Down
2 changes: 1 addition & 1 deletion app/readers/petvalu.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


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

0 comments on commit 0ae8bd9

Please sign in to comment.