![]() However, I get the impression that it is overly complicated and includes too much nesting of the function which reduces readability. There can also be found some example URLs which mock bad server behaviour (based on httpbin). as well as the location and filename for downloading the file can be specified on top of the script within the CONFIGURATION section. The URL and other connection parameters such as connection timeout, read timeout, maximum download attempts etc. In this case, the download attempt should be retried until a predefined maximum of download tries is exceeded. 'connection refused' or 'HTTP 400 response code'. ![]() If the server gives a bad HTTP response code (anything but 200) or no connection could be established at all, a revealing error message should be printed, giving the specific type of error (e.g. ![]() a HTML file) should be downloaded to hard disk. In case that a connection to the server can be established and a valid response is received, the response (e.g. I wrote a script for Python 2.78 which is supposed to download and save a file from a given URL using the requests library.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |