Wyjaśnienie sesji asynchronicznej w żądaniach-html
from requests_html import AsyncHTMLSession
asession = AsyncHTMLSession()
async def get_cnn():
r = await asession.get('https://edition.cnn.com/')
title = r.html.find('title')[0].text
print(title)
async def get_google():
r = await asession.get('https://google.com/')
title = r.html.find('title')[0].text
print(title)
async def get_facebook():
r = await asession.get('https://facebook.com/')
title = r.html.find('title')[0].text
print(title)
asession.run(get_google, get_facebook,get_cnn )Copy Code
Pythonist