requests-html icon indicating copy to clipboard operation
requests-html copied to clipboard

await

Open tellts opened this issue 3 years ago • 3 comments

Microsoft Windows [Version 10.0.19044.1766] (c) Корпорация Майкрософт (Microsoft Corporation). Все права защищены.

C:\Users\admin>python Python 3.9.5 (tags/v3.9.5:0a7dcbd, May 3 2021, 17:27:52) [MSC v.1928 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information.

from requests_html import AsyncHTMLSession asession = AsyncHTMLSession() r = await asession.get('https://python.org/') File "", line 1 SyntaxError: 'await' outside function

tellts avatar Jul 04 '22 03:07 tellts

I figured out what the problem is. Javascript components have not been installed.

tellts avatar Jul 17 '22 16:07 tellts

from requests_html import AsyncHTMLSession
asession = AsyncHTMLSession()

async def test():
    r = await asession.get("https://python.org")

asession.run(test)

NGoedix avatar Jul 29 '22 17:07 NGoedix

Thanks to. Yes. I studied the example and then realized that I need to run the render function so that the missing components are downloaded first. Perhaps it's better to download the components separately manually and install, since it didn't start downloading on the first try, if I remember correctly.

tellts avatar Jul 29 '22 17:07 tellts

Alright, closing!

surister avatar Feb 13 '23 21:02 surister