requests-html python code example

Example 1: requests-html

>>> print(about.text)
About
Applications
Quotes
Getting Started
Help
Python Brochure

Example 2: requests-html

>>> about = r.html.find('#about', first=True)

Example 3: requests-html

>>> from requests_html import AsyncHTMLSession
>>> asession = AsyncHTMLSession()

>>> async def get_pythonorg():
...    r = await asession.get('https://python.org/')

>>> async def get_reddit():
...    r = await asession.get('https://reddit.com/')

>>> async def get_google():
...    r = await asession.get('https://google.com/')

>>> result = session.run(get_pythonorg, get_reddit, get_google)

Example 4: requests-html

>>> r.html.search('Python is a {} language')[0]
programming

Example 5: requests-html

>>> about.find('a')
[<Element 'a' href='/about/' title='' class=''>, <Element 'a' href='/about/apps/' title=''>, <Element 'a' href='/about/quotes/' title=''>, <Element 'a' href='/about/gettingstarted/' title=''>, <Element 'a' href='/about/help/' title=''>, <Element 'a' href='http://brochure.getpython.info/' title=''>]

Tags:

Html Example