1
0
mirror of https://github.com/spaam/svtplay-dl.git synced 2024-11-24 04:05:39 +01:00

postprocess: return und if we cant get the right language

This commit is contained in:
Johan Andersson 2016-11-27 19:20:41 +01:00
parent a9c579ba5f
commit 80992f8664

View File

@ -40,8 +40,11 @@ class postprocess(object):
try:
r = post(url, data=dumps(payload), headers=headers, timeout=30) # Note: reasonable timeout i guess? svtplay-dl is mainly used while multitasking i presume, and it is heroku after all (fast enough)
if r.status_code == codes.ok:
response = r.json()
return response['language']
try:
response = r.json()
return response['language']
except TypeError:
return 'und'
else:
log.error("Server error appeared. Setting language as undetermined.")
return 'und'