Disable InsecureRequestWarning

When using gertty with SSL certificate validation turned off the
InsecureRequestWarning is shown on the screen on every REST
request (http://imgur.com/i18F1iO) which renders gertty pretty
useless.  This changes disables the warnings when SSL certificate
validation is disabled.

Change-Id: Id6f46e85168bba599f8380b6613d8835d65661c3
This commit is contained in:
Khai Do 2015-02-18 21:05:52 -08:00
parent ac0c988603
commit 65aec10f1c

View File

@ -841,6 +841,9 @@ class Sync(object):
self.log = logging.getLogger('gertty.sync')
self.queue = MultiQueue([HIGH_PRIORITY, NORMAL_PRIORITY, LOW_PRIORITY])
self.result_queue = Queue.Queue()
# Disable InsecureRequestWarning when certificate validation is disabled
if not self.app.config.verify_ssl:
requests.packages.urllib3.disable_warnings()
self.session = requests.Session()
if self.app.config.auth_type == 'basic':
authclass = requests.auth.HTTPBasicAuth