Skip to content

Commit 5d7c859

Browse files
authored
Merge pull request #193 from pennyarcade/master
Update requests_html.py
2 parents 16c0dbe + 96dbba8 commit 5d7c859

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

requests_html.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ class HTMLSession(requests.Session):
647647
amongst other things.
648648
"""
649649

650-
def __init__(self, mock_browser=True):
650+
def __init__(self, mock_browser=True, browser_args=['--no-sandbox']):
651651
super(HTMLSession, self).__init__()
652652

653653
# Mock a web browser's user agent.
@@ -656,6 +656,8 @@ def __init__(self, mock_browser=True):
656656

657657
self.hooks = {'response': self._handle_response}
658658

659+
self.__browser_args = browser_args
660+
659661
@staticmethod
660662
def _handle_response(response, **kwargs) -> HTMLResponse:
661663
"""Requests HTTP Response handler. Attaches .html property to
@@ -679,7 +681,7 @@ def request(self, *args, **kwargs) -> HTMLResponse:
679681
def browser(self):
680682
if not hasattr(self, "_browser"):
681683
self.loop = asyncio.get_event_loop()
682-
self._browser = self.loop.run_until_complete(pyppeteer.launch(headless=True, args=['--no-sandbox']))
684+
self._browser = self.loop.run_until_complete(pyppeteer.launch(headless=True, args=self.__browser_args))
683685
return self._browser
684686

685687
def close(self):

0 commit comments

Comments
 (0)