mirror of
https://github.com/rembo10/headphones.git
synced 2026-07-22 08:53:59 +01:00
check for affected python versions
This commit is contained in:
@@ -22,11 +22,6 @@ sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'lib/'))
|
|||||||
|
|
||||||
from headphones import webstart, logger
|
from headphones import webstart, logger
|
||||||
|
|
||||||
if sys.version_info >= (2, 7, 9):
|
|
||||||
import ssl
|
|
||||||
# pylint: disable=W0212
|
|
||||||
ssl._create_default_https_context = ssl._create_unverified_context
|
|
||||||
|
|
||||||
import locale
|
import locale
|
||||||
import time
|
import time
|
||||||
import signal
|
import signal
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ from headphones import logger
|
|||||||
from xml.dom import minidom
|
from xml.dom import minidom
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
|
|
||||||
|
import sys
|
||||||
import requests
|
import requests
|
||||||
import feedparser
|
import feedparser
|
||||||
import headphones
|
import headphones
|
||||||
@@ -54,6 +55,14 @@ def request_response(url, method="get", auto_raise=True,
|
|||||||
# pose a security issue!
|
# pose a security issue!
|
||||||
kwargs["verify"] = bool(headphones.CONFIG.VERIFY_SSL_CERT)
|
kwargs["verify"] = bool(headphones.CONFIG.VERIFY_SSL_CERT)
|
||||||
|
|
||||||
|
#This fix is put in place for systems with broken SSL (like QNAP)
|
||||||
|
if not headphones.CONFIG.VERIFY_SSL_CERT and sys.version_info >= (2, 7, 9):
|
||||||
|
try:
|
||||||
|
import ssl
|
||||||
|
ssl._create_default_https_context = ssl._create_unverified_context
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
# 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.
|
||||||
request_method = getattr(requests, method.lower())
|
request_method = getattr(requests, method.lower())
|
||||||
|
|||||||
Reference in New Issue
Block a user