mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-08-19 12:59:42 -07:00
Supress InsecureRequestWarning for requests without ssl verify
This commit is contained in:
parent
9a00350ffc
commit
53aa740305
1 changed files with 5 additions and 0 deletions
|
@ -23,6 +23,7 @@ from xml.dom import minidom
|
||||||
|
|
||||||
import collections
|
import collections
|
||||||
import requests
|
import requests
|
||||||
|
from requests.packages import urllib3
|
||||||
|
|
||||||
import plexpy
|
import plexpy
|
||||||
if plexpy.PYTHON2:
|
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
|
# Disable verification of SSL certificates if requested. Note: this could
|
||||||
# pose a security issue!
|
# pose a security issue!
|
||||||
kwargs["verify"] = bool(plexpy.CONFIG.VERIFY_SSL_CERT)
|
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
|
# 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.
|
# 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
|
# Disable verification of SSL certificates if requested. Note: this could
|
||||||
# pose a security issue!
|
# pose a security issue!
|
||||||
kwargs['verify'] = bool(plexpy.CONFIG.VERIFY_SSL_CERT)
|
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
|
# 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.
|
# allows requests to apply more magic per method. See lib/requests/api.py.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue