Skip to content Skip to sidebar Skip to footer

Why Is The Error "cannot Use Htmlsession Within An Existing Event Loop. Use Asynchtmlsession Instead"?

I'm running the code provided by @Dan-Dev in his answer. from requests_html import HTMLSession url = 'https://www.thefreedictionary.com/love' session = HTMLSession() r = session.g

Solution 1:

You may try this:

import nest_asyncio

nest_asyncio.apply()

session = HTMLSession()
r = session.get("URL")

html_str = r.text

Post a Comment for "Why Is The Error "cannot Use Htmlsession Within An Existing Event Loop. Use Asynchtmlsession Instead"?"