MCPcopy Index your code
hub / github.com/psf/requests-html / __init__

Method __init__

requests_html.py:413–428  ·  view source on GitHub ↗
(self, *, session: Union['HTMLSession', 'AsyncHTMLSession'] = None, url: str = DEFAULT_URL, html: _HTML, default_encoding: str = DEFAULT_ENCODING, async_: bool = False)

Source from the content-addressed store, hash-verified

411 """
412
413 def __init__(self, *, session: Union['HTMLSession', 'AsyncHTMLSession'] = None, url: str = DEFAULT_URL, html: _HTML, default_encoding: str = DEFAULT_ENCODING, async_: bool = False) -> None:
414
415 # Convert incoming unicode HTML into bytes.
416 if isinstance(html, str):
417 html = html.encode(DEFAULT_ENCODING)
418
419 super(HTML, self).__init__(
420 # Convert unicode HTML to bytes.
421 element=PyQuery(html)('html') or PyQuery(f'<html>{html}</html>')('html'),
422 html=html,
423 url=url,
424 default_encoding=default_encoding
425 )
426 self.session = session or async_ and AsyncHTMLSession() or HTMLSession()
427 self.page = None
428 self.next_symbol = DEFAULT_NEXT_SYMBOL
429
430 def __repr__(self) -> str:
431 return f"<HTML url={self.url!r}>"

Callers 5

__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45

Calls 2

AsyncHTMLSessionClass · 0.85
HTMLSessionClass · 0.85

Tested by

no test coverage detected