INNER CODE UNIT · Python
f
trevorhobenshield/twitter-api-client · scripts/update.py:147
async def f(client: AsyncClient, sem: Semaphore, cfg: dict) -> Response:
return await backoff(client.request, sem, **cfg, **kwargs)
return (partial(f, cfg=cfg) for cfg in cfgs)
async def process(fns: Generator, max_connections: int = 2000, **kwargs):
client_defaults = {
'cookies': kwargs.pop('cookies', None),
'headers': {'user-agent': random.choice(USER_AGENTS)} | kwargs.pop('headers', {}),
'timeout': kwargs.pop('timeout', 30.0),
'verify': kwargs.pop('verify', False),
'http2': kwargs.pop('http2', True),
'follow_redirects': kwargs.pop('follow_redirects', True),
'limits': kwargs.pop('limits', Limits(
max_connections=max_connections,
max_keepalive_connections=None,
keepalive_expiry=5.0,