def get_remote_tweets(sources, limit=None, timeout=5.0, cache=None):
conn = aiohttp.TCPConnector(use_dns_cache=True)
headers = generate_user_agent()
with aiohttp.ClientSession(connector=conn, headers=headers, conn_timeout=timeout) as client:
loop = asyncio.get_event_loop()
def start_loop(client, sources, limit, cache=None):
return loop.run_until_complete(process_sources_for_file(client, sources, limit, cache))
tweets = start_loop(client, sources, limit, cache)
return tweets
评论列表
文章目录