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.2.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.2-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: onlinezip-0.0.2.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.2.tar.gz
Algorithm Hash digest
SHA256 7712bac8e081ec1f33fb7582332478299a09bf0a079d34bf72d9191aeab5ead4
MD5 e22faeccbe386fef651b802b24e7a525
BLAKE2b-256 ec59fa2c7e975dfb1f278e2c9d00e21d96ef63fa0419fe0d4130231ddc48b6b6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: onlinezip-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 17.6 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1c01f17a145332d3a631483a380fdf0bac4b451e3010498aa5a515afc0fc53f6
MD5 4efb1c8a0c1f6581125ac40a46a448a5
BLAKE2b-256 0252625001a6791d2e65fad92f06e345ac1197d35a1bd958d69a57459cb00d4c

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