For a more robust code to check a website python solution, try `httpx`. It’s like `requests` but async-ready and has better timeout handling.
```python
import httpx
async def check_site(url):
try:
async with httpx.AsyncClient() as client:
resp = await client.get(url, timeout=10)
print(resp.status_code)
except httpx.RequestError:
print("Site’s having a bad day.")
```
Great for checking multiple sites fast!
```python
import httpx
async def check_site(url):
try:
async with httpx.AsyncClient() as client:
resp = await client.get(url, timeout=10)
print(resp.status_code)
except httpx.RequestError:
print("Site’s having a bad day.")
```
Great for checking multiple sites fast!
