mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-10 07:22:37 -07:00
Catch HTTP errors for Imgur upload
This commit is contained in:
parent
ca29333cd0
commit
bc42e79bb5
1 changed files with 13 additions and 10 deletions
|
@ -546,6 +546,7 @@ def uploadToImgur(imgPath, imgTitle=''):
|
|||
data['title'] = imgTitle
|
||||
data['name'] = imgTitle + '.jpg'
|
||||
|
||||
try:
|
||||
request = urllib2.Request('https://api.imgur.com/3/image', headers=headers, data=urllib.urlencode(data))
|
||||
response = urllib2.urlopen(request)
|
||||
response = json.loads(response.read())
|
||||
|
@ -557,5 +558,7 @@ def uploadToImgur(imgPath, imgTitle=''):
|
|||
logger.warn(u"PlexPy Helpers :: Unable to upload image to Imgur: %s" % response.reason)
|
||||
else:
|
||||
logger.warn(u"PlexPy Helpers :: Unable to upload image to Imgur.")
|
||||
except urllib2.HTTPError as e:
|
||||
logger.warn(u"PlexPy Helpers :: Unable to upload image to Imgur: %s" % e)
|
||||
|
||||
return img_url
|
Loading…
Add table
Add a link
Reference in a new issue