Create http.py
Browse files- core/http.py +10 -0
core/http.py
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
import httpx
|
| 3 |
+
from .config import settings
|
| 4 |
+
|
| 5 |
+
def client() -> httpx.AsyncClient:
|
| 6 |
+
return httpx.AsyncClient(
|
| 7 |
+
timeout=httpx.Timeout(settings.http_timeout_s),
|
| 8 |
+
headers={"user-agent": "ToxRAI/0.2 (HF Space demo)"},
|
| 9 |
+
follow_redirects=True,
|
| 10 |
+
)
|