mirror of
https://github.com/kennethreitz/requests-html.git
synced 2026-06-05 06:46:14 +00:00
render without requests
Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
This commit is contained in:
@@ -177,6 +177,27 @@ You can also use this library without Requests:
|
||||
>>> html.links
|
||||
{'https://httpbin.org'}
|
||||
|
||||
You can also render JavaScript pages without Requests:
|
||||
|
||||
.. code-block:: pycon
|
||||
|
||||
# ^^ proceeding from above ^^
|
||||
>>> script = """
|
||||
() => {
|
||||
return {
|
||||
width: document.documentElement.clientWidth,
|
||||
height: document.documentElement.clientHeight,
|
||||
deviceScaleFactor: window.devicePixelRatio,
|
||||
}
|
||||
}
|
||||
"""
|
||||
>>> val = html.render(script=script, reload=False)
|
||||
|
||||
>>> print(val)
|
||||
{'width': 800, 'height': 600, 'deviceScaleFactor': 1}
|
||||
|
||||
>>> print(html.html)
|
||||
<html><head></head><body><a href="https://httpbin.org"></a></body></html>
|
||||
|
||||
API Documentation
|
||||
=================
|
||||
|
||||
Reference in New Issue
Block a user