From 53aa740305ae9500025ce97fb441da0d5354c5b7 Mon Sep 17 00:00:00 2001 From: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> Date: Sat, 16 May 2020 17:30:44 -0700 Subject: [PATCH] Supress InsecureRequestWarning for requests without ssl verify --- plexpy/request.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plexpy/request.py b/plexpy/request.py index 79bcdb12..e639442e 100644 --- a/plexpy/request.py +++ b/plexpy/request.py @@ -23,6 +23,7 @@ from xml.dom import minidom import collections import requests +from requests.packages import urllib3 import plexpy if plexpy.PYTHON2: @@ -59,6 +60,8 @@ def request_response(url, method="get", auto_raise=True, # Disable verification of SSL certificates if requested. Note: this could # pose a security issue! kwargs["verify"] = bool(plexpy.CONFIG.VERIFY_SSL_CERT) + if not kwargs['verify']: + urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) # Map method to the request.XXX method. This is a simple hack, but it # allows requests to apply more magic per method. See lib/requests/api.py. @@ -149,6 +152,8 @@ def request_response2(url, method="get", auto_raise=True, # Disable verification of SSL certificates if requested. Note: this could # pose a security issue! kwargs['verify'] = bool(plexpy.CONFIG.VERIFY_SSL_CERT) + if not kwargs['verify']: + urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) # Map method to the request.XXX method. This is a simple hack, but it # allows requests to apply more magic per method. See lib/requests/api.py.