From 65aec10f1c4152e0bd751ecda4c8000cb6947e57 Mon Sep 17 00:00:00 2001 From: Khai Do <zaro0508@gmail.com> Date: Wed, 18 Feb 2015 21:05:52 -0800 Subject: [PATCH] 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 --- gertty/sync.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gertty/sync.py b/gertty/sync.py index f036bbd..704856a 100644 --- a/gertty/sync.py +++ b/gertty/sync.py @@ -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