There was an error while loading. Please reload this page.
1 parent 36da47d commit 668e893Copy full SHA for 668e893
1 file changed
web_programming/covid_stats_via_xpath.py
@@ -37,14 +37,14 @@ def covid_stats(
37
) -> CovidData:
38
xpath_str = '//div[@class = "maincounter-number"]/span/text()'
39
try:
40
- response = httpx.get(url, timeout=10).raise_for_status()
41
- except httpx.TimeoutException:
+ response = httpx2.get(url, timeout=10).raise_for_status()
+ except httpx2.TimeoutException:
42
logging.error(
43
"Request timed out. Please check your network connection "
44
"or try again later."
45
)
46
return CovidData("N/A", "N/A", "N/A")
47
- except httpx.HTTPStatusError as e:
+ except httpx2.HTTPStatusError as e:
48
logging.error(f"HTTP error occurred: {e}")
49
50
data: list[str] = html.fromstring(response.content).xpath(xpath_str)
0 commit comments