more aspectratio issues, wrap delete_url
This commit is contained in:
parent
5ae5bd3a84
commit
fc7769c4cb
1 changed files with 12 additions and 1 deletions
|
@ -18,12 +18,21 @@ from . import duckduckgo
|
|||
from ..utils import datetime
|
||||
from ..geo import normalize_country_name
|
||||
|
||||
def read_url(url, data=None, headers=cache.DEFAULT_HEADERS, timeout=cache.cache_timeout, valid=None, unicode=False):
|
||||
|
||||
def prepare_url(url, data=None, headers=cache.DEFAULT_HEADERS, timeout=cache.cache_timeout, valid=None, unicode=False):
|
||||
headers = headers.copy()
|
||||
# https://webapps.stackexchange.com/questions/11003/how-can-i-disable-reconfigure-imdbs-automatic-geo-location-so-it-does-not-defau
|
||||
headers['X-Forwarded-For'] = '72.21.206.80'
|
||||
return url, data, headers, timeout, unicode
|
||||
|
||||
def read_url(url, data=None, headers=cache.DEFAULT_HEADERS, timeout=cache.cache_timeout, valid=None, unicode=False):
|
||||
url, data, headers, timeout, unicode = prepare_url(url, data, headers, timeout, valid, unicode)
|
||||
return cache.read_url(url, data, headers, timeout, unicode=unicode)
|
||||
|
||||
def delete_url(url, data=None, headers=cache.DEFAULT_HEADERS):
|
||||
url, data, headers, timeout, unicode = prepare_url(url, data, headers)
|
||||
cache.store.delete(url, data, headers)
|
||||
|
||||
def get_url(id):
|
||||
return "http://www.imdb.com/title/tt%s/" % id
|
||||
|
||||
|
@ -74,6 +83,8 @@ def parse_aspectratio(value):
|
|||
value = str(float(n) / float(d))
|
||||
except:
|
||||
print('failed to parse aspect: %s' % value)
|
||||
else:
|
||||
value = '.'.join(value.strip().split('.')[:2])
|
||||
return value
|
||||
|
||||
'''
|
||||
|
|
Loading…
Reference in a new issue