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)
| 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 | |
| 641 | class HTMLResponse(requests.Response): |