Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suppress insecure HTTPS warning when upgrading TLJH #357

Merged
merged 1 commit into from
May 29, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 7 additions & 2 deletions tljh/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
import subprocess
import sys
import time
import warnings

import pluggy
import requests
from requests.packages.urllib3.exceptions import InsecureRequestWarning

from tljh import (
apt,
Expand Down Expand Up @@ -292,8 +294,11 @@ def ensure_jupyterhub_running(times=20):
for i in range(times):
try:
logger.info('Waiting for JupyterHub to come up ({}/{} tries)'.format(i + 1, times))
# We don't care at this level that SSL is valid
requests.get('http://127.0.0.1', verify=False)
# Because we don't care at this level that SSL is valid, we can suppress
# InsecureRequestWarning for this request.
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=InsecureRequestWarning)
requests.get('http://127.0.0.1', verify=False)
return
except requests.HTTPError as h:
if h.response.status_code in [404, 502, 503]:
Expand Down