Richienb / virusshare-hashes

Every single VirusShare MD5 hash in a single file.
MIT License
19 stars 6 forks source link

Download not stopped on HTTP errors #10

Closed fmkaiser closed 1 year ago

fmkaiser commented 1 year ago

First of all thanks for providing this useful tool!

However at least on my machine with Python 3.6.15, requests==2.28.1, the script tries to download files even after receiving 404 errors from the server!

It seems that at least in newer versions of the requests library, requests.exceptions.HTTPError is not raised unless explicitly calling response.raise_for_status.

So it might be a good idea to either do that after the requests.get() call, or just check response.ok.

Richienb commented 1 year ago

unless explicitly calling response.raise_for_status.

PR welcome to add this

fmkaiser commented 1 year ago

Wow, that was fast ;)

Here is the pull request, it's a pretty trivial change.

I hope it doesn't cause problems with ancient versions of the requests library. But from what I can see in the changelog the raise_for_status function has been a thing for a long time.