Skip to content
This repository has been archived by the owner on May 8, 2020. It is now read-only.

Disable progress bar through environmental variable #153

Merged
merged 1 commit into from
Sep 27, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion pyppeteer/chromium_downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
REVISION = os.environ.get(
'PYPPETEER_CHROMIUM_REVISION', __chromium_revision__)

NO_PROGRESS_BAR = os.environ.get('PYPPETEER_NO_PROGRESS_BAR', '')
if NO_PROGRESS_BAR.lower() in ('1', 'true'):
NO_PROGRESS_BAR = True

downloadURLs = {
'linux': f'{BASE_URL}/Linux_x64/{REVISION}/chrome-linux.zip',
'mac': f'{BASE_URL}/Mac/{REVISION}/chrome-mac.zip',
Expand Down Expand Up @@ -82,7 +86,7 @@ def download_zip(url: str) -> BytesIO:
except (KeyError, ValueError, AttributeError):
total_length = 0

process_bar = tqdm(total=total_length)
process_bar = tqdm(total=total_length, file=os.devnull if NO_PROGRESS_BAR else None)

# 10 * 1024
_data = BytesIO()
Expand Down