mirror of
https://github.com/flibusta-apps/books_downloader.git
synced 2025-12-06 06:55:37 +01:00
Fix convertation error catching
This commit is contained in:
@@ -201,7 +201,7 @@ class FLDownloader(BaseDownloader):
|
|||||||
form = {"format": self.file_type}
|
form = {"format": self.file_type}
|
||||||
files = {"file": open(filename_to_convert, "rb")}
|
files = {"file": open(filename_to_convert, "rb")}
|
||||||
|
|
||||||
converter_client = httpx.AsyncClient(timeout=2 * 60)
|
converter_client = httpx.AsyncClient(timeout=5 * 60)
|
||||||
converter_request = converter_client.build_request(
|
converter_request = converter_client.build_request(
|
||||||
"POST", env_config.CONVERTER_URL, data=form, files=files
|
"POST", env_config.CONVERTER_URL, data=form, files=files
|
||||||
)
|
)
|
||||||
@@ -210,6 +210,9 @@ class FLDownloader(BaseDownloader):
|
|||||||
converter_response = await converter_client.send(
|
converter_response = await converter_client.send(
|
||||||
converter_request, stream=True
|
converter_request, stream=True
|
||||||
)
|
)
|
||||||
|
except httpx.ReadTimeout:
|
||||||
|
await converter_client.aclose()
|
||||||
|
raise ConvertationError()
|
||||||
except asyncio.CancelledError:
|
except asyncio.CancelledError:
|
||||||
await converter_client.aclose()
|
await converter_client.aclose()
|
||||||
raise
|
raise
|
||||||
|
|||||||
Reference in New Issue
Block a user