pyguymer3.download_file

pyguymer3.download_file(sess, url, fname, /, *, cookies=None, debug=True, headers=None, setModificationTime=True, timeout=10.0, verify=True)[source]

GET a URL and save the content in a file

This function performs a HTTP GET operation on a URL and saves the content in a file, and optionally sets the Last-Modified time if available.

Parameters:
  • sess (requests.sessions.Session) – the requests session to use

  • url (str) – the URL

  • fname (str) – the name of the file to save the content in

  • cookies (dict, optional) – the cookie jar

  • debug (bool, optional) – print debug messages

  • headers (dict, optional) – extra headers to send

  • timeout (float, optional) – the timeout of the GET request

  • setModificationTime (bool, optional) – set the Last-Modified time if available.

  • verify (bool, optional) – verify the server’s certificates

Returns:

resp – the success of the download

Return type:

bool

Notes

Copyright 2017 Thomas Guymer [1]

References