Spaces:
Running
Running
Create services/fetcher.py
Browse files- services/fetcher.py +8 -0
services/fetcher.py
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# services/fetcher.py
|
| 2 |
+
import httpx
|
| 3 |
+
|
| 4 |
+
async def fetch_html(url: str) -> str:
|
| 5 |
+
async with httpx.AsyncClient(timeout=30.0) as client:
|
| 6 |
+
resp = await client.get(url)
|
| 7 |
+
resp.raise_for_status()
|
| 8 |
+
return resp.text
|