seekablehttpfile

raw JSON →
0.1.0 verified Sat May 09 auth: no python

Provides a lazy-loading, seekable file-like object for remote HTTP files using Range requests. Version 0.1.0 supports Python >= 3.7. Low release cadence.

pip install seekablehttpfile
error AttributeError: module 'seekablehttpfile' has no attribute 'SeekableHttpFile'
cause Incorrect import path (e.g., from seekablehttpfile.seekablehttpfile import ...). Only top-level import is supported.
fix
Use: from seekablehttpfile import SeekableHttpFile
error requests.exceptions.InvalidURL: Failed to parse: <url>
cause The library expects a valid HTTP/HTTPS URL. Relative paths or missing scheme cause this.
fix
Ensure the URL starts with http:// or https://.
error TypeError: 'NoneType' object is not iterable
cause Passing an invalid URL that returns a non-200 response (e.g., 404) without proper handling. The library tries to parse response headers.
fix
Check the URL is reachable and returns a valid Content-Range header.
gotcha The file is lazy-loaded; no data is fetched until first read or seek. An erroneous URL will only raise an exception on read, not on construction.
fix Call a small read or check status explicitly after construction if you want to fail fast.
gotcha Seeking backwards may cause repeated HTTP requests if the new position is before the currently buffered data. The implementation caches entire chunks, but large backward seeks can be inefficient.
fix Consider using a different strategy for random access patterns or limit seek range.
deprecated No deprecations known at version 0.1.0.

Opens a remote file via HTTP Range requests and reads a chunk after seeking.

from seekablehttpfile import SeekableHttpFile

# Open a remote file with seek support
with SeekableHttpFile('https://example.com/large-file.bin') as f:
    f.seek(1000)
    data = f.read(1024)
    print(len(data))