fix(api): Add logfiles to gitignore, remove debug code
This commit is contained in:
@@ -7,3 +7,4 @@ build
|
|||||||
.vscode
|
.vscode
|
||||||
.venv
|
.venv
|
||||||
.env
|
.env
|
||||||
|
*log
|
||||||
|
|||||||
@@ -177,7 +177,6 @@ async def fetch_story_id(
|
|||||||
@backoff.on_exception(backoff.expo, ClientResponseError, max_time=15)
|
@backoff.on_exception(backoff.expo, ClientResponseError, max_time=15)
|
||||||
async def retrieve_story(story_id: int, cookies: Optional[dict] = None) -> dict:
|
async def retrieve_story(story_id: int, cookies: Optional[dict] = None) -> dict:
|
||||||
"""Taking a story_id, return its information from the Wattpad API."""
|
"""Taking a story_id, return its information from the Wattpad API."""
|
||||||
print("using cache", None if cookies else cache)
|
|
||||||
with start_action(action_type="api_fetch_story", story_id=story_id):
|
with start_action(action_type="api_fetch_story", story_id=story_id):
|
||||||
async with CachedSession(
|
async with CachedSession(
|
||||||
headers=headers, cookies=cookies, cache=None if cookies else cache
|
headers=headers, cookies=cookies, cache=None if cookies else cache
|
||||||
|
|||||||
@@ -156,7 +156,6 @@ async def handle_download(
|
|||||||
async for title in add_chapters(
|
async for title in add_chapters(
|
||||||
book, metadata, download_images=download_images, cookies=cookies
|
book, metadata, download_images=download_images, cookies=cookies
|
||||||
):
|
):
|
||||||
print(title)
|
|
||||||
...
|
...
|
||||||
|
|
||||||
# Book is compiled
|
# Book is compiled
|
||||||
|
|||||||
@@ -1,31 +0,0 @@
|
|||||||
import asyncio
|
|
||||||
from datetime import datetime
|
|
||||||
import aiohttp
|
|
||||||
from rich import print
|
|
||||||
|
|
||||||
|
|
||||||
PORT: int = 8086
|
|
||||||
DOWNLOAD_URL = (
|
|
||||||
f"http://localhost:{PORT}/download/314175600?om=1&download_images=true&mode=story"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
async def fetch(task_id: int, session: aiohttp.ClientSession):
|
|
||||||
print("started", task_id)
|
|
||||||
|
|
||||||
start = datetime.now()
|
|
||||||
async with session.get(DOWNLOAD_URL) as response:
|
|
||||||
print(task_id, response.status)
|
|
||||||
end = datetime.now()
|
|
||||||
|
|
||||||
print("time taken", (end - start).total_seconds())
|
|
||||||
|
|
||||||
|
|
||||||
async def main():
|
|
||||||
session = aiohttp.ClientSession()
|
|
||||||
|
|
||||||
await asyncio.gather(*[fetch(i, session) for i in range(30)])
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
asyncio.run(main())
|
|
||||||
Reference in New Issue
Block a user