Timeout for stream file.

This commit is contained in:
grossmj
2018-06-10 21:18:16 +07:00
parent 34fcbd68f3
commit 45edc40948
2 changed files with 5 additions and 4 deletions

View File

@ -337,12 +337,13 @@ class Compute:
return response
@asyncio.coroutine
def stream_file(self, project, path):
def stream_file(self, project, path, timeout=None):
"""
Read file of a project and stream it
:param project: A project object
:param path: The path of the file in the project
:param timeout: timeout
:returns: A file stream
"""
@ -361,7 +362,7 @@ class Compute:
self._response.close()
url = self._getUrl("/projects/{}/stream/{}".format(project.id, path))
response = yield from self._session().request("GET", url, auth=self._auth, timeout=None)
response = yield from self._session().request("GET", url, auth=self._auth, timeout=timeout)
if response.status == 404:
raise aiohttp.web.HTTPNotFound(text="{} not found on compute".format(path))
elif response.status == 403: