INNER CODE UNIT · Python
process
trevorhobenshield/twitter-api-client · scripts/update.py:153
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,
))
}
# tqdm
desc = kwargs.pop('desc', None)
sem = Semaphore(max_connections)
async with AsyncClient(**client_defaults, **kwargs) as client: