Skip to main content

Reading zip file through network

Project description

Onlinezip

Onlinezip is a Python library for reading zip file through network without downloading whole file locally.

You can read one entry or whole zip file entry by entry.

It may be useful when you want to read just few entries or file is really big and you don't want to download it at once.

Prerequisites

server with zip file must fulfill two conditions:

  • respond to HTTP HEAD request
  • allows to read bytes in ranges

Most modern servers supports this.

Installation

Use the package manager pip to install onlinezip.

pip install onlinezip

Usage

OnlineZip juz extending ZipFile. If you know how to use ZiFile class you also know how to use OnlineZip.

To start just pass url to constructor.

from onlinezip.OnlineZip import OnlineZip

zip = OnlineZip('https://public-onlinezip.s3.eu-west-1.amazonaws.com/zip.zip')
# returns names of all files in zip
zip.namelist()

# extract file a.txt to local directory
zip.extract('a.txt')

# extract all files
zip.extractall()

# open file
with zip.open('a.txt') as myfile:
    print(myfile.read())

Please remember that entries aren't stored neither cache so each time you calls method that read entry you are downloading it.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

GNU GENERAL PUBLIC LICENSE

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

onlinezip-0.0.1.tar.gz (17.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

onlinezip-0.0.1-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

Details for the file onlinezip-0.0.1.tar.gz.

File metadata

  • Download URL: onlinezip-0.0.1.tar.gz
  • Upload date:
  • Size: 17.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.62.3 importlib-metadata/4.8.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.7.0

File hashes

Hashes for onlinezip-0.0.1.tar.gz
Algorithm Hash digest
SHA256 1b00f7437dbcc3ab79379e69589b3f3ce006dc8752f0fd0450db4be74b2be0a4
MD5 d98843e15ad50449809b7311dfcf8b6d
BLAKE2b-256 324d44bbafad242c9be94c38b269c41b3cb31bd446ebfb9649e313f5d17d7128

See more details on using hashes here.

File details

Details for the file onlinezip-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: onlinezip-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 17.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.62.3 importlib-metadata/4.8.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.7.0

File hashes

Hashes for onlinezip-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7d5abad4582f5e75301eb9be38b86e1cf6a60da29a317cec21b248307da29a53
MD5 2ae48c8f9167411805370dc0ffc85637
BLAKE2b-256 93a2cd1edae48280ede6f625dacfcb3b2b648c0f7ad3dcb216e9acbcc049deb8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page