download#

pypillometry.download(url, fname=None, chunk_size=1024, session=None)[source]#

Download a file from a URL to a local file.

See https://gist.github.com/yanqd0/c13ed29e29432e3cf3e7c38467f42f51.

Parameters:
  • url (str) – URL of the file to download.

  • fname (str) – Local filename to save the file to. If None, create a temporary file.

  • chunk_size (int) – Size of the chunks to download the file in. Default is 1024.

  • session (Optional[Session]) – requests session to use for the download. If None, a new session is created.

Return type:

str

Returns:

Local filename of the downloaded file.