MCPcopy
hub / github.com/psf/requests-html / arender

Method arender

requests_html.py:612–638  ·  view source on GitHub ↗

Async version of render. Takes same parameters.

(self, retries: int = 8, script: str = None, wait: float = 0.2, scrolldown=False, sleep: int = 0, reload: bool = True, timeout: Union[float, int] = 8.0, keep_page: bool = False)

Source from the content-addressed store, hash-verified

610 return result
611
612 async def arender(self, retries: int = 8, script: str = None, wait: float = 0.2, scrolldown=False, sleep: int = 0, reload: bool = True, timeout: Union[float, int] = 8.0, keep_page: bool = False):
613 """ Async version of render. Takes same parameters. """
614
615 self.browser = await self.session.browser
616 content = None
617
618 # Automatically set Reload to False, if example URL is being used.
619 if self.url == DEFAULT_URL:
620 reload = False
621
622 for _ in range(retries):
623 if not content:
624 try:
625
626 content, result, page = await self._async_render(url=self.url, script=script, sleep=sleep, wait=wait, content=self.html, reload=reload, scrolldown=scrolldown, timeout=timeout, keep_page=keep_page)
627 except TypeError:
628 pass
629 else:
630 break
631
632 if not content:
633 raise MaxRetries("Unable to render the page. Try increasing timeout")
634
635 html = HTML(url=self.url, html=content.encode(DEFAULT_ENCODING), default_encoding=DEFAULT_ENCODING)
636 self.__dict__.update(html.__dict__)
637 self.page = page
638 return result
639
640
641class HTMLResponse(requests.Response):

Callers 3

test_bare_arenderFunction · 0.95
test_bare_js_async_evalFunction · 0.95
test_async_renderFunction · 0.80

Calls 3

_async_renderMethod · 0.95
MaxRetriesClass · 0.85
HTMLClass · 0.85

Tested by 3

test_bare_arenderFunction · 0.76
test_bare_js_async_evalFunction · 0.76
test_async_renderFunction · 0.64