mirror of
https://github.com/kennethreitz/requests-html.git
synced 2026-06-05 23:00:20 +00:00
no more global session
Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
This commit is contained in:
+5
-3
@@ -25,7 +25,9 @@ Make a GET request to 'python.org', using Requests:
|
||||
|
||||
.. code-block:: pycon
|
||||
|
||||
>>> from requests_html import session
|
||||
>>> import requests_html
|
||||
>>> session = requests_html.Session()
|
||||
|
||||
>>> r = session.get('https://python.org/')
|
||||
|
||||
Grab a list of all links on the page, as–is (anchors excluded):
|
||||
@@ -73,14 +75,14 @@ Select Elements within Elements:
|
||||
|
||||
>>> 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=''>]
|
||||
|
||||
|
||||
Search for links within an element:
|
||||
|
||||
.. code-block:: pycon
|
||||
|
||||
>>> about.absolute_links
|
||||
{'http://brochure.getpython.info/', 'https://www.python.org/about/gettingstarted/', 'https://www.python.org/about/', 'https://www.python.org/about/quotes/', 'https://www.python.org/about/help/', 'https://www.python.org/about/apps/'}
|
||||
|
||||
|
||||
|
||||
Search for text on the page:
|
||||
|
||||
|
||||
@@ -202,5 +202,3 @@ class Session(requests.Session):
|
||||
|
||||
response.html = HTML(response=response)
|
||||
return response
|
||||
|
||||
session = Session()
|
||||
|
||||
Reference in New Issue
Block a user