mirror of
https://github.com/flibusta-apps/telegram_files_cache_server.git
synced 2025-12-06 14:45:36 +01:00
Use base book info endpoing
This commit is contained in:
@@ -18,6 +18,11 @@ class Page(BaseModel, Generic[T]):
|
|||||||
total_pages: int
|
total_pages: int
|
||||||
|
|
||||||
|
|
||||||
|
class BaseBookInfo:
|
||||||
|
id: int
|
||||||
|
available_types: list[str]
|
||||||
|
|
||||||
|
|
||||||
class BookAuthor(BaseModel):
|
class BookAuthor(BaseModel):
|
||||||
id: int
|
id: int
|
||||||
first_name: str
|
first_name: str
|
||||||
@@ -71,14 +76,14 @@ async def get_book(
|
|||||||
return await get_book(book_id, retry=retry - 1, last_exp=e)
|
return await get_book(book_id, retry=retry - 1, last_exp=e)
|
||||||
|
|
||||||
|
|
||||||
async def get_books(page: int, page_size: int) -> Page[Book]:
|
async def get_books(page: int, page_size: int) -> Page[BaseBookInfo]:
|
||||||
id_gte = page * page_size
|
id_gte = page * page_size
|
||||||
id_lte = (page + 1) * page_size - 1
|
id_lte = (page + 1) * page_size - 1
|
||||||
|
|
||||||
async with httpx.AsyncClient(timeout=5 * 60) as client:
|
async with httpx.AsyncClient(timeout=5 * 60) as client:
|
||||||
response = await client.get(
|
response = await client.get(
|
||||||
(
|
(
|
||||||
f"{env_config.LIBRARY_URL}/api/v1/books/"
|
f"{env_config.LIBRARY_URL}/api/v1/books/base/"
|
||||||
f"?is_deleted=false&id_gte={id_gte}&id_lte={id_lte}&no_cache=true"
|
f"?is_deleted=false&id_gte={id_gte}&id_lte={id_lte}&no_cache=true"
|
||||||
),
|
),
|
||||||
headers=AUTH_HEADERS,
|
headers=AUTH_HEADERS,
|
||||||
|
|||||||
Reference in New Issue
Block a user