compatibility fixes to make a standalone exe work
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
|
||||
"""Common classes and constants used by extractor modules."""
|
||||
|
||||
import os
|
||||
import time
|
||||
import queue
|
||||
import requests
|
||||
@@ -94,3 +95,21 @@ def safe_request(session, url, method="GET", *args, **kwargs):
|
||||
|
||||
# everything ok -- proceed to download
|
||||
return r
|
||||
|
||||
|
||||
# The first import of requests happens inside this file.
|
||||
# If we are running on Windows and the from requests expected certificate file
|
||||
# is missing (which happens in a standalone executable from py2exe), the
|
||||
# requests.Session object gets monkey patched to always set its 'verify'
|
||||
# attribute to False to avoid an exception being thrown when attempting to
|
||||
# access https:// URLs.
|
||||
|
||||
if os.name == "nt":
|
||||
import os.path
|
||||
import requests.certs
|
||||
if not os.path.isfile(requests.certs.where()):
|
||||
def patched_init(self):
|
||||
session_init(self)
|
||||
self.verify = False
|
||||
session_init = requests.Session.__init__
|
||||
requests.Session.__init__ = patched_init
|
||||
|
||||
@@ -19,7 +19,7 @@ class KhinsiderSoundtrackExtractor(AsynchronousExtractor):
|
||||
filename_fmt = "{filename}"
|
||||
pattern = [r"(?:https?://)?downloads\.khinsider\.com/game-soundtracks/album/(.+)"]
|
||||
test = [("http://downloads.khinsider.com/game-soundtracks/album/horizon-riders-wii-", {
|
||||
"url": "35ff4c8310884664408dc5560fda3b06157f7606",
|
||||
"url": "732639e9e72e169f8ec36a71609471aaf67451e0",
|
||||
"keyword": "d91cf3edee6713b536eaf3995743f0be7dc72f68",
|
||||
})]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user