diff --git a/src/app/services/book_library.py b/src/app/services/book_library.py index 33ddcd0..1da9c77 100644 --- a/src/app/services/book_library.py +++ b/src/app/services/book_library.py @@ -49,7 +49,7 @@ class BookLibraryClient: @classmethod async def _make_request(cls, url) -> dict: - async with httpx.AsyncClient() as client: + async with httpx.AsyncClient(timeout=60) as client: response = await client.get(url, headers=cls.auth_headers) return response.json() diff --git a/src/app/services/fl_downloader.py b/src/app/services/fl_downloader.py index 1590827..45a7553 100644 --- a/src/app/services/fl_downloader.py +++ b/src/app/services/fl_downloader.py @@ -44,7 +44,7 @@ class FLDownloader(BaseDownloader): if self.book is None: raise ValueError("Book is None!") - return get_filename(self.book, self.file_type) + return get_filename(self.book_id, self.book, self.file_type) async def get_final_filename(self) -> str: if self.need_zip: diff --git a/src/app/services/utils.py b/src/app/services/utils.py index 4b579b8..e99c1fe 100644 --- a/src/app/services/utils.py +++ b/src/app/services/utils.py @@ -54,7 +54,7 @@ def get_short_name(author: BookAuthor) -> str: return " ".join(name_parts) -def get_filename(book: Book, file_type: str) -> str: +def get_filename(book_id: int, book: Book, file_type: str) -> str: filename_parts = [] if book.authors: @@ -86,6 +86,6 @@ def get_filename(book: Book, file_type: str) -> str: ): filename = filename.replace(c, r) - right_part = f".{book.id}.{file_type}" + right_part = f".{book_id}.{file_type}" return filename[: 64 - len(right_part)] + right_part