Verified Commit fe55ed80 authored by Eliot Berriot's avatar Eliot Berriot 💬

Faster CLI startup time by moving aiohttp import to runtime

parent cf66e93d
Pipeline #4594 passed with stages
in 3 minutes and 9 seconds
import aiohttp
from . import exceptions
from . import schemas
from . import settings
def get_session_kwargs():
import aiohttp
headers = {"User-Agent": settings.USER_AGENT}
return {
"timeout": aiohttp.ClientTimeout(total=settings.TIMEOUT),
......@@ -14,6 +14,8 @@ def get_session_kwargs():
def get_session():
import aiohttp
kwargs = get_session_kwargs()
return aiohttp.ClientSession(**kwargs)
......
import asyncio
import aiohttp
import click
import click_log
import dotenv
......@@ -110,6 +109,7 @@ def env_file(v):
def async_command(f):
def wrapper(*args, **kwargs):
import aiohttp
loop = asyncio.get_event_loop()
ignore_aiohttp_ssl_eror(loop)
_async_reraise = kwargs.pop("_async_reraise", False)
......
import os
import pathlib
import aiohttp
import click
import tqdm
......@@ -70,6 +69,8 @@ async def get_track_download_url(id, remote, format=None):
async def track_download(
ctx, id, format, directory, template, overwrite, ignore_errors, skip_existing
):
import aiohttp
async with ctx.obj["remote"]:
progressbar = tqdm.tqdm(id, unit="Files")
for i in progressbar:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment