Request objects represent remote resource, in the form of a URL, and local storage in form of either a path or an open file-like object.
DownloadRequest class has these parameters:
- url (required) the URL of the file to be downloaded as a string
- destination (required) either a local filesystem path as a string or an open file-like object
- data (optional) arbitrary data that will be passed back as part of a corresponding report object
- headers (optional) a dictionary of additional headers
def __init__(self, url, destination, data=None, headers=None):
The URL parameter
url must be of a scheme (read: protocol) supported by the
downloader instance that it will be passed to.
destination parameter is either an absolute filesystem path as a string
or an open file-like object. If the destination is an open file-like object, the
downloader will not close it upon completion of the download; even if an
destination = '/tmp/myfile' destination = open('/tmp/myfile', wb)
headers parameter is an option dictionary that can contain any custom
headers for a particular request.