From f2a99240655c18a1b719f75c2642fdb7615d2ff6 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Wed, 28 Feb 2018 08:43:42 -0500 Subject: [PATCH] render without requests Signed-off-by: Kenneth Reitz --- docs/source/index.rst | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/docs/source/index.rst b/docs/source/index.rst index feb45aa..86182c7 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -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) + API Documentation =================