From 84a85c75d06bcbaa118267046f6404ebffeaea8c Mon Sep 17 00:00:00 2001 From: kiwi0fruit Date: Wed, 16 Jan 2019 00:22:26 +0700 Subject: [PATCH 1/3] added certifi https download --- pyppeteer/chromium_downloader.py | 12 +++++------- setup.py | 3 ++- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/pyppeteer/chromium_downloader.py b/pyppeteer/chromium_downloader.py index 6111bac9..f8496c88 100644 --- a/pyppeteer/chromium_downloader.py +++ b/pyppeteer/chromium_downloader.py @@ -13,6 +13,7 @@ import urllib3 from tqdm import tqdm +import certifi from pyppeteer import __chromium_revision__, __pyppeteer_home__ @@ -69,17 +70,14 @@ def get_url() -> str: def download_zip(url: str) -> BytesIO: """Download data from url.""" - logger.warning('start chromium download.\n' + logger.warning('start secure https chromium download.\n' 'Download may take a few minutes.') - # disable warnings so that we don't need a cert. - # see https://urllib3.readthedocs.io/en/latest/advanced-usage.html for more - urllib3.disable_warnings() - - with urllib3.PoolManager() as http: + with urllib3.PoolManager(cert_reqs='CERT_REQUIRED', + ca_certs=certifi.where()) as https: # Get data from url. # set preload_content=False means using stream later. - data = http.request('GET', url, preload_content=False) + data = https.request('GET', url, preload_content=False) try: total_length = int(data.headers['content-length']) diff --git a/setup.py b/setup.py index 48b7b37c..662c6fb8 100644 --- a/setup.py +++ b/setup.py @@ -46,7 +46,8 @@ 'websockets', 'appdirs', 'urllib3', - 'tqdm' + 'tqdm', + 'certifi' ] test_requirements = [ From 1bb7c20bed0f36942a9b39bcb21018acbe360fe8 Mon Sep 17 00:00:00 2001 From: kiwi0fruit Date: Wed, 16 Jan 2019 02:03:50 +0700 Subject: [PATCH 2/3] bugfix for rev. > 591479 on win --- pyppeteer/chromium_downloader.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pyppeteer/chromium_downloader.py b/pyppeteer/chromium_downloader.py index f8496c88..2a5c23f1 100644 --- a/pyppeteer/chromium_downloader.py +++ b/pyppeteer/chromium_downloader.py @@ -32,19 +32,20 @@ if NO_PROGRESS_BAR.lower() in ('1', 'true'): NO_PROGRESS_BAR = True # type: ignore +win_postf = "win" if int(REVISION) > 591479 else "win32" downloadURLs = { 'linux': f'{BASE_URL}/Linux_x64/{REVISION}/chrome-linux.zip', 'mac': f'{BASE_URL}/Mac/{REVISION}/chrome-mac.zip', - 'win32': f'{BASE_URL}/Win/{REVISION}/chrome-win32.zip', - 'win64': f'{BASE_URL}/Win_x64/{REVISION}/chrome-win32.zip', + 'win32': f'{BASE_URL}/Win/{REVISION}/chrome-{win_postf}.zip', + 'win64': f'{BASE_URL}/Win_x64/{REVISION}/chrome-{win_postf}.zip', } chromiumExecutable = { 'linux': DOWNLOADS_FOLDER / REVISION / 'chrome-linux' / 'chrome', 'mac': (DOWNLOADS_FOLDER / REVISION / 'chrome-mac' / 'Chromium.app' / 'Contents' / 'MacOS' / 'Chromium'), - 'win32': DOWNLOADS_FOLDER / REVISION / 'chrome-win32' / 'chrome.exe', - 'win64': DOWNLOADS_FOLDER / REVISION / 'chrome-win32' / 'chrome.exe', + 'win32': DOWNLOADS_FOLDER / REVISION / f'chrome-{win_postf}' / 'chrome.exe', + 'win64': DOWNLOADS_FOLDER / REVISION / f'chrome-{win_postf}' / 'chrome.exe', } From cf633c179d5bdabaed037caccf98a76ac5819e06 Mon Sep 17 00:00:00 2001 From: Peter Zagubisalo Date: Sat, 26 Jan 2019 21:53:25 +0700 Subject: [PATCH 3/3] chromium upd --- pyppeteer/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyppeteer/__init__.py b/pyppeteer/__init__.py index c1e4859c..3b04aba1 100644 --- a/pyppeteer/__init__.py +++ b/pyppeteer/__init__.py @@ -11,7 +11,7 @@ __author__ = """Hiroyuki Takagi""" __email__ = 'miyako.dev@gmail.com' __version__ = '0.0.25' -__chromium_revision__ = '588429' +__chromium_revision__ = '609904' __base_puppeteer_version__ = 'v1.6.0' __pyppeteer_home__ = os.environ.get( 'PYPPETEER_HOME', AppDirs('pyppeteer').user_data_dir) # type: str