Skip to content

Commit ca7e35c

Browse files
committed
Clean init formatting.
1 parent 926065a commit ca7e35c

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

asyncio_tutorial/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from asyncio_tutorial.logger import LOGGER
77
from asyncio_tutorial.tasks import create_tasks
8-
from config import HTML_EXPORT_DIR, HTML_HEADERS
8+
from config import EXPORT_DIR, HTML_HEADERS
99
from data import parse_urls
1010

1111
from .logger import LOGGER
@@ -15,11 +15,11 @@ async def init_script():
1515
"""Open async HTTP session & execute created tasks."""
1616
urls = parse_urls()
1717
async with ClientSession(headers=HTML_HEADERS) as session:
18-
tasks = await create_tasks(session, urls, HTML_EXPORT_DIR)
18+
tasks = await create_tasks(session, urls, EXPORT_DIR)
1919
await asyncio.gather(*tasks)
20-
loop_status = await inspect_loop()
20+
await inspect_loop()
2121
LOGGER.success(
22-
f"Saved {len(urls)} HTML pages to `{HTML_EXPORT_DIR}`. {loop_status}"
22+
f"Saved {len(urls)} files to `{EXPORT_DIR}`"
2323
)
2424

2525

@@ -32,4 +32,4 @@ async def inspect_loop() -> str:
3232
:return: str
3333
"""
3434
loop = asyncio.get_event_loop()
35-
return f"Loop finished in {loop.time()} seconds."
35+
return LOGGER.info(f"Loop finished in {loop.time()} seconds.")

config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
CSV_FILEPATH = f"{BASE_DIR}/data/urls.csv"
99

1010
# Directory in which HTML export will be saved
11-
HTML_EXPORT_DIR = f"{BASE_DIR}/export/"
11+
EXPORT_DIR = f"{BASE_DIR}/export/"
1212

1313
# Headers to be passed to async HTTP client session
1414
HTML_HEADERS = {

0 commit comments

Comments
 (0)