mirror of
https://github.com/SickGear/SickGear.git
synced 2024-12-02 17:33:37 +00:00
Change TVDB API 2 to version 2.2.0
Fix TVDB header not being send. Fix typo in Ek class fix_list_encoding(x). Change fixListEncodings for better readability.
This commit is contained in:
parent
f28a7bf6cf
commit
e7b2693765
3 changed files with 23 additions and 12 deletions
|
@ -63,7 +63,7 @@
|
|||
|
||||
# Send PostProcessing requests to SickGear
|
||||
#
|
||||
# PostProcessing-Script version: 1.6.
|
||||
# PostProcessing-Script version: 1.7.
|
||||
# <!--
|
||||
# For more info and updates please visit forum topic at
|
||||
# -->
|
||||
|
@ -157,7 +157,7 @@ import re
|
|||
import sys
|
||||
import warnings
|
||||
|
||||
__version__ = '1.6'
|
||||
__version__ = '1.7'
|
||||
|
||||
verbose = 0 or 'yes' == os.environ.get('NZBPO_SG_VERBOSE', 'no')
|
||||
|
||||
|
@ -281,11 +281,17 @@ class Ek:
|
|||
return x
|
||||
return None
|
||||
|
||||
@staticmethod
|
||||
def fix_out_encoding(x):
|
||||
if isinstance(x, basestring):
|
||||
return Ek.fix_string_encoding(x)
|
||||
return x
|
||||
|
||||
@staticmethod
|
||||
def fix_list_encoding(x):
|
||||
if type(x) not in (list, tuple):
|
||||
return x
|
||||
return filter(lambda i: None is not i, map(Ek.fix_string_encoding, i))
|
||||
return filter(lambda i: None is not i, map(Ek.fix_out_encoding, x))
|
||||
|
||||
@staticmethod
|
||||
def encode_item(x):
|
||||
|
|
|
@ -9,7 +9,7 @@ from functools import wraps
|
|||
|
||||
__author__ = 'dbr/Ben'
|
||||
__version__ = '2.0'
|
||||
__api_version__ = '2.1.2'
|
||||
__api_version__ = '2.2.0'
|
||||
|
||||
import os
|
||||
import time
|
||||
|
@ -580,19 +580,19 @@ class Tvdb:
|
|||
log().debug('Using proxy for URL: %s' % url)
|
||||
session.proxies = {'http': self.config['proxy'], 'https': self.config['proxy']}
|
||||
|
||||
session.headers.update({'Accept-Encoding': 'gzip,deflate', 'Authorization': 'Bearer %s' % self.get_token(),
|
||||
'Accept': 'application/vnd.thetvdb.v%s' % __api_version__})
|
||||
headers = {'Accept-Encoding': 'gzip,deflate', 'Authorization': 'Bearer %s' % self.get_token(),
|
||||
'Accept': 'application/vnd.thetvdb.v%s' % __api_version__}
|
||||
|
||||
if None is not language and language in self.config['valid_languages']:
|
||||
session.headers.update({'Accept-Language': language})
|
||||
headers.update({'Accept-Language': language})
|
||||
|
||||
resp = None
|
||||
if self._match_url_pattern('url_seriesInfo', url):
|
||||
self.show_not_found = False
|
||||
self.not_found = False
|
||||
try:
|
||||
resp = getURL(url.strip(), params=params, session=session, json=True, raise_status_code=True,
|
||||
raise_exceptions=True)
|
||||
resp = getURL(url.strip(), params=params, session=session, headers=headers, json=True,
|
||||
raise_status_code=True, raise_exceptions=True)
|
||||
except requests.exceptions.HTTPError as e:
|
||||
if 401 == e.response.status_code:
|
||||
# token expired, get new token, raise error to retry
|
||||
|
|
|
@ -42,11 +42,16 @@ def fixStupidEncodings(x, silent=False):
|
|||
return None
|
||||
|
||||
|
||||
def fixOutEncoding(x):
|
||||
if isinstance(x, basestring):
|
||||
return fixStupidEncodings(x)
|
||||
return x
|
||||
|
||||
|
||||
def fixListEncodings(x):
|
||||
if type(x) != list and type(x) != tuple:
|
||||
if type(x) not in (list, tuple):
|
||||
return x
|
||||
else:
|
||||
return filter(lambda x: x != None, map(fixStupidEncodings, x))
|
||||
return filter(lambda i: None is not i, map(fixOutEncoding, x))
|
||||
|
||||
|
||||
def callPeopleStupid(x):
|
||||
|
|
Loading…
Reference in a new issue