Skip to content

Commit

Permalink
Merge pull request psf#223 from pigna90/verify-parameter
Browse files Browse the repository at this point in the history
Add verify parameter coherently
  • Loading branch information
kennethreitz committed Sep 19, 2018
2 parents 004a9b6 + 8c6b3b3 commit aca88e4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion requests_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,7 @@ def render(self, retries: int = 8, script: str = None, wait: float = 0.2, scroll
if self.url == DEFAULT_URL:
reload = False


for i in range(retries):
if not content:
try:
Expand Down Expand Up @@ -696,9 +697,11 @@ def __init__(self, mock_browser : bool = True, verify : bool = False,
self.headers['User-Agent'] = user_agent()

self.hooks['response'].append(self.response_hook)
self.verify = verify

self.__browser_args = browser_args


def response_hook(self, response, **kwargs) -> HTMLResponse:
""" Change response enconding and replace it by a HTMLResponse. """
if not response.encoding:
Expand All @@ -708,7 +711,8 @@ def response_hook(self, response, **kwargs) -> HTMLResponse:
@property
async def browser(self):
if not hasattr(self, "_browser"):
self._browser = await pyppeteer.launch(ignoreHTTPSErrors=self.verify, headless=True, args=self.__browser_args)
self._browser = await pyppeteer.launch(ignoreHTTPSErrors=not(self.verify), headless=True, args=self.__browser_args)

return self._browser


Expand Down

0 comments on commit aca88e4

Please sign in to comment.