Seekable HTTP responses using 'Range' headers for python-requests
Project description
requests-seekable
Open HTTP responses as seekable file objects. When seek() is called, a new request is made with
the Range header set.
This is useful for extracting files from large web-based .zip archives.
Usage
If your existing code looks like this:
import requests
response = requests.get('https://example.com', stream=True)
fileobj = response.raw # not seekable :(
Then replace response.raw with SeekableResponse(response):
import requests
import requests_seekable
response = requests.get('https://example.com', stream=True)
fileobj = requests_seekable.SeekableResponse(response) # seekable :)
If the server doesn't support Range headers, then SeekableResponse initializer raises a
SeekError exception. This type of exception (a subclass of OSError) is also raised from
SeekableResponse.seek() in the following cases:
- If the given whence value isn't
SEEK_SET(0),SEEK_CUR(1) orSEEK_END(2); or - If the given whence value is
SEEK_ENDbut the content length isn't known; or - If the response status isn't 206 "Partial Content" or 416 "Range Not Satisfiable".
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file requests_seekable-0.1.0.tar.gz.
File metadata
- Download URL: requests_seekable-0.1.0.tar.gz
- Upload date:
- Size: 14.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
80937c40efd440ba0a0b19a6036c7ca3a42e2021c849eff6cdf3519520844aa1
|
|
| MD5 |
0104432fc49817429ce11b10a3d57183
|
|
| BLAKE2b-256 |
e64788192b4bb3307f6d63330e150a5f463eb086cdbf8a67be9945cac228dba0
|
Provenance
The following attestation bundles were made for requests_seekable-0.1.0.tar.gz:
Publisher:
build.yaml on barneygale/requests-seekable
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
requests_seekable-0.1.0.tar.gz -
Subject digest:
80937c40efd440ba0a0b19a6036c7ca3a42e2021c849eff6cdf3519520844aa1 - Sigstore transparency entry: 496402481
- Sigstore integration time:
-
Permalink:
barneygale/requests-seekable@7fd9c86fbabadeaf6b1c1faa6d308a77d406f787 -
Branch / Tag:
refs/tags/0.1.0 - Owner: https://github.com/barneygale
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build.yaml@7fd9c86fbabadeaf6b1c1faa6d308a77d406f787 -
Trigger Event:
push
-
Statement type:
File details
Details for the file requests_seekable-0.1.0-py3-none-any.whl.
File metadata
- Download URL: requests_seekable-0.1.0-py3-none-any.whl
- Upload date:
- Size: 15.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd60e5567367a38437cbb91da4dd87e9aae0095ea07af8a6ffd4462750bc8434
|
|
| MD5 |
e30fa45aa84e76393dddb4802f549804
|
|
| BLAKE2b-256 |
d55b202f3d3ab8c7a37d1354841baaaf6d68c8b6517a51dc1d6c8d484b76b9db
|
Provenance
The following attestation bundles were made for requests_seekable-0.1.0-py3-none-any.whl:
Publisher:
build.yaml on barneygale/requests-seekable
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
requests_seekable-0.1.0-py3-none-any.whl -
Subject digest:
fd60e5567367a38437cbb91da4dd87e9aae0095ea07af8a6ffd4462750bc8434 - Sigstore transparency entry: 496402522
- Sigstore integration time:
-
Permalink:
barneygale/requests-seekable@7fd9c86fbabadeaf6b1c1faa6d308a77d406f787 -
Branch / Tag:
refs/tags/0.1.0 - Owner: https://github.com/barneygale
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build.yaml@7fd9c86fbabadeaf6b1c1faa6d308a77d406f787 -
Trigger Event:
push
-
Statement type: