alexgisby / imgur-album-downloader

Python script/class to download an entire Imgur album in one go into a folder of your choice.
MIT License
340 stars 59 forks source link

Doesn't raise 404 exceptions properly #13

Closed stevesbrain closed 10 years ago

stevesbrain commented 10 years ago

Looks like 404 exceptions are not handled properly at the moment

⇒  python3 imguralbum.py http://imgur.com/a/lidsifuje ./
Traceback (most recent call last):
  File "imguralbum.py", line 162, in <module>
    downloader = ImgurAlbumDownloader(args[1])
  File "imguralbum.py", line 64, in __init__
    self.response = urllib.request.urlopen(url=noscriptURL)
  File "/usr/lib/python3.4/urllib/request.py", line 153, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python3.4/urllib/request.py", line 461, in open
    response = meth(req, response)
  File "/usr/lib/python3.4/urllib/request.py", line 571, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python3.4/urllib/request.py", line 499, in error
    return self._call_chain(*args)
  File "/usr/lib/python3.4/urllib/request.py", line 433, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.4/urllib/request.py", line 579, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: Not Found
alexgisby commented 10 years ago

Good find, I'll try and get this patched this evening.

Thanks for the report!

stevesbrain commented 10 years ago

My pleasure :)

alexgisby commented 10 years ago

Right this show now be fixed and the friendly message outputted if the HTTP request fails :)

stevesbrain commented 10 years ago

Awesome :)