Access zip file content hosted remotely without downloading the full file.
Maintained. Last release 3 months ago, commits in 2 of the last 26 weeks. Weaker on commit activity and release cadence.
pip install remotezipremotezip
This module provides a way to access single members of a zip file archive without downloading the full content from a remote web server. For this library to work, the web server hosting the archive needs to support the range header.
Installation
pip install remotezip
Usage
Initialization
RemoteZip(url, ...)
To download the content, this library rely on the requests module. The constructor interface matches the function requests.get module.
- url: URL where the zip file is located (required).
- auth: authentication credentials.
- headers: headers to pass to the request.
- timeout: timeout for the request.
- verify: enable/disable certificate verification or set custom certificates location.
- ... Please look at the requests documentation for further usage details.
- initial_buffer_size: How much data (in bytes) to fetch during the first connection to download the zip file central directory. If your zip file contains a lot of files, would be a good idea to increase this parameter in order to avoid the need for further remote requests. Default: 64kb.
- session: a custom session object to use for the request.
- support_suffix_range: You can set this attribute to
Falseif the remote server doesn't support suffix range (negative offset). Notice that this option will use one more HEAD request to fetch the content length.
Class Interface
RemoteZip is a subclass of the python standard library class zipfile.ZipFile, so it supports all its read methods:
RemoteZip.close()RemoteZip.getinfo(name)RemoteZip.extract(member[, path[, pwd]])RemoteZip.extractall([path[, members[, pwd]]])