Spaces:
Sleeping
Sleeping
Corrected logs extraction
Browse files
main.py
CHANGED
|
@@ -535,10 +535,11 @@ def _resolve_space_repo(space: str) -> str:
|
|
| 535 |
|
| 536 |
|
| 537 |
async def _stream_hf_logs(log_type: str, space_repo: str):
|
| 538 |
-
"""Stream logs from HF API (run or build). space_repo e.g. DATFID-org/datfid_api.
|
|
|
|
| 539 |
url = f"https://huggingface.co/api/spaces/{space_repo}/logs/{log_type}"
|
| 540 |
headers = {"Authorization": f"Bearer {HF_TOKEN}"}
|
| 541 |
-
client = httpx.AsyncClient(timeout=60.0)
|
| 542 |
stream_ctx = client.stream("GET", url, headers=headers)
|
| 543 |
|
| 544 |
async def body_iter():
|
|
|
|
| 535 |
|
| 536 |
|
| 537 |
async def _stream_hf_logs(log_type: str, space_repo: str):
|
| 538 |
+
"""Stream logs from HF API (run or build). space_repo e.g. DATFID-org/datfid_api.
|
| 539 |
+
Hub returns 307 redirect to canonical URL; follow_redirects=True so we get 200 + body."""
|
| 540 |
url = f"https://huggingface.co/api/spaces/{space_repo}/logs/{log_type}"
|
| 541 |
headers = {"Authorization": f"Bearer {HF_TOKEN}"}
|
| 542 |
+
client = httpx.AsyncClient(timeout=60.0, follow_redirects=True)
|
| 543 |
stream_ctx = client.stream("GET", url, headers=headers)
|
| 544 |
|
| 545 |
async def body_iter():
|