Registry / storage / serverfiles

serverfiles

JSON →
library0.3.1pypypi✓ verified 88d ago

A utility that accesses files on a HTTP server and stores them locally for reuse with caching and integrity checks. Current version 0.3.1, release cadence is low.

pip install serverfiles
INSTALL
IMPORT
SIG · SERVERFILES
S
serverfiles
storagepythonv0.3.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ServerFiles
✓ from serverfiles import ServerFiles
✗ from serverfiles.server import ServerFiles
older internal path

Initialize with URL and local cache path, then download files with automatic caching.

from serverfiles import ServerFiles sf = ServerFiles('https://example.com/path/to/files/', localpath='/tmp/my_cache') # download file and cache locally local_path = sf.get('file.txt') print(local_path) # e.g., /tmp/my_cache/file.txt
Debug
Known issues
deprecatedPython 2 support is deprecated. Use Python 3.6+.
fix
Upgrade to Python 3 and use serverfiles >=0.3.0.
affects: <0.3.0
gotchalocalpath must exist or be writable; function does not create directories automatically.
fix
Ensure the directory exists before initializing ServerFiles.
affects: all
gotchaget() raises RuntimeError if HTTP server returns non-200, not a Python requests exception.
fix
Wrap get() in try-except for RuntimeError.
affects: all
breakingIn version 0.3.0, the module structure changed. Import path 'serverfiles.server' no longer works.
fix
Use 'from serverfiles import ServerFiles' instead.
affects: >=0.3.0
Errors
Common errors & fixes
RuntimeError: Server returned status 404: Not Found
Requested file does not exist on server, or URL is incorrect.
fix
Verify the file URL and that the file exists on the server.
ModuleNotFoundError: No module named 'serverfiles'
Package not installed.
fix
Run 'pip install serverfiles'.
AttributeError: 'ServerFiles' object has no attribute 'get'
Using an outdated version of serverfiles where method names differ.
fix
Update to the latest version (>=0.3.0) and use 'get()'.
Upgrade
Version history
0.3.1latest on PyPI · released Jan 22, 2021
Audit
Dependencies

No dependency data recorded yet.

Agent activity
30 hits · last 30 days
node
28
Resources
serverfiles — pip install serverfiles · libregistry