lundi 31 juillet 2017

Catch the 400 Bad request before stopping the script

I downloaded files like this and it sometimes returns 400 request.

f = urllib.request.urlretrieve(url,"filename")

So I would like to check if it returns 400 error ,skip and continue to the next procedure.

However if it returns 400 , the program stops with this error.

urllib.error.HTTPError: HTTP Error 400: Bad Request

How can I don't let 400 error stop the program?




Aucun commentaire:

Enregistrer un commentaire