diff --git a/README.rst b/README.rst index 820c03a..6dba6f3 100644 --- a/README.rst +++ b/README.rst @@ -151,7 +151,7 @@ You can also use this library without Requests: >>> from requests_html import HTML >>> doc = """""" - >>> html = HTML(html=doc, url='fakeurl', default_encoding='utf-8') + >>> html = HTML(html=doc) >>> html.links {'https://httpbin.org'} diff --git a/docs/source/index.rst b/docs/source/index.rst index feac635..fd7e55c 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -173,7 +173,7 @@ You can also use this library without Requests: >>> from requests_html import HTML >>> doc = """""" - >>> html = HTML(html=doc, url='fakeurl', default_encoding='utf-8') + >>> html = HTML(html=doc) >>> html.links {'https://httpbin.org'} diff --git a/requests_html.py b/requests_html.py index 12a33cd..44d5631 100644 --- a/requests_html.py +++ b/requests_html.py @@ -17,6 +17,7 @@ from w3lib.encoding import html_to_unicode DEFAULT_ENCODING = 'utf-8' +DEFAULT_URL = 'https://example.org/' useragent = UserAgent() @@ -204,7 +205,7 @@ class Element(BaseParser): class HTML(BaseParser): """An HTML document, ready for parsing.""" - def __init__(self, *, url, html, default_encoding=DEFAULT_ENCODING) -> None: + def __init__(self, *, url=DEFAULT_URL, html, default_encoding=DEFAULT_ENCODING) -> None: super(HTML, self).__init__( element=PyQuery(html)('html'), html=html,