#87 fix ssl context in several places. update comicvine api url.
This commit is contained in:
parent
43a913294e
commit
7e8fc143fd
@ -14,9 +14,6 @@ else:
|
||||
if not os.environ.get("UNRAR_LIB_PATH", None):
|
||||
os.environ["UNRAR_LIB_PATH"] = bundle_dir + "/libunrar.so"
|
||||
|
||||
print os.environ.get("UNRAR_LIB_PATH", None)
|
||||
print bundle_dir
|
||||
|
||||
from comictaggerlib.main import ctmain
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
@ -91,7 +91,7 @@ class ComicVineTalker(QObject):
|
||||
def __init__(self):
|
||||
QObject.__init__(self)
|
||||
|
||||
self.api_base_url = "http://www.comicvine.com/api"
|
||||
self.api_base_url = "https://comicvine.gamespot.com/api"
|
||||
self.wait_for_rate_limit = False
|
||||
|
||||
# key that is registered to comictagger
|
||||
@ -104,6 +104,9 @@ class ComicVineTalker(QObject):
|
||||
|
||||
self.log_func = None
|
||||
|
||||
# always use a tls context for urlopen
|
||||
self.ssl = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
|
||||
|
||||
def setLogFunc(self, log_func):
|
||||
self.log_func = log_func
|
||||
|
||||
@ -132,7 +135,7 @@ class ComicVineTalker(QObject):
|
||||
|
||||
test_url = self.api_base_url + "/issue/1/?api_key=" + \
|
||||
key + "&format=json&field_list=name"
|
||||
resp = urllib2.urlopen(test_url)
|
||||
resp = urllib2.urlopen(test_url, context=self.ssl)
|
||||
content = resp.read()
|
||||
|
||||
cv_response = json.loads(content)
|
||||
@ -185,8 +188,7 @@ class ComicVineTalker(QObject):
|
||||
# print "ATB---", url
|
||||
for tries in range(3):
|
||||
try:
|
||||
context = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
|
||||
resp = urllib2.urlopen(url, context=context)
|
||||
resp = urllib2.urlopen(url, context=self.ssl)
|
||||
return resp.read()
|
||||
except urllib2.HTTPError as e:
|
||||
if e.getcode() == 500:
|
||||
@ -676,7 +678,7 @@ class ComicVineTalker(QObject):
|
||||
return url_list
|
||||
|
||||
# scrape the CV issue page URL to get the alternate cover URLs
|
||||
resp = urllib2.urlopen(issue_page_url)
|
||||
resp = urllib2.urlopen(issue_page_url, context=self.ssl)
|
||||
content = resp.read()
|
||||
alt_cover_url_list = self.parseOutAltCoverUrls(content)
|
||||
|
||||
|
@ -20,6 +20,7 @@ import datetime
|
||||
import shutil
|
||||
import tempfile
|
||||
import urllib
|
||||
import ssl
|
||||
#import urllib2
|
||||
|
||||
try:
|
||||
@ -65,6 +66,9 @@ class ImageFetcher(QObject):
|
||||
if not os.path.exists(self.db_file):
|
||||
self.create_image_db()
|
||||
|
||||
# always use a tls context for urlopen
|
||||
self.ssl = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
|
||||
|
||||
def clearCache(self):
|
||||
os.unlink(self.db_file)
|
||||
if os.path.isdir(self.cache_folder):
|
||||
@ -87,7 +91,7 @@ class ImageFetcher(QObject):
|
||||
if blocking:
|
||||
if image_data is None:
|
||||
try:
|
||||
image_data = urllib.urlopen(url).read()
|
||||
image_data = urllib.urlopen(url, context=self.ssl).read()
|
||||
except Exception as e:
|
||||
print(e)
|
||||
raise ImageFetcherException("Network Error!")
|
||||
|
Loading…
x
Reference in New Issue
Block a user