Skip to content

Commit

Permalink
Add timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
Chiara Rasi committed Feb 6, 2024
1 parent fa507ec commit 9a135f6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion schug/load/fetch_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ def fetch_resource(url: str) -> List[str]:

async def stream_resource(url: str) -> AsyncGenerator:
"""Stream a file from an external service"""
async with httpx.AsyncClient(timeout=None) as client:
timeout = httpx.Timeout(connect=None, read=None, write=None, pool=None)
async with httpx.AsyncClient(timeout=timeout) as client:
async with client.stream("GET", url) as r:
async for chunk in r.aiter_bytes():
yield chunk

0 comments on commit 9a135f6

Please sign in to comment.