chicken_turtle_util.http

HTTP utilities. Contains only download, download a http resource.

download Download an HTTP resource to a file
chicken_turtle_util.http.download(url, destination)[source]

Download an HTTP resource to a file

Parameters:

url : str

HTTP resource to download

destination : pathlib.Path

Location at which to store downloaded resource. If destination does not exist, it’s assumed to be a file path. If destination exists and is a file, it is overwritten. If destination exists and is a directory, the file will be saved inside the directory with as name the file name suggested by a server, if any, or the last part of the URL otherwise (excluding query and fragment parts).

Returns:

path : pathlib.Path

Path to the downloaded file.

name : str or None

File name suggested by the server or None if none was suggested.