FileServer
a simple static fileserver and directory index server in python (WSGI app)
About
Often for testing you will want a static fileserver and directory index as part of your WSGI stack. In addition, you may have requirements to run such as part of a production WSGI stack. FileServer fits these needs.
Motivation
I needed a directory index server a la Apache to test a PyPI clone I was using. After surveying what was out there, there didn’t seem anything out there that was easily consumable for my purposes. So I wrote one only depending on webob .
Contents
from fileserver import * should give you access to all of the usable components of fileserver:
file_response: return a webob response object appropriate to a file name
FileApp: WSGI app that wraps file_response
Directory Server: serves a directory tree and generated indices
main: command line entry point
FileApp and file_response are heavily borrowed from http://docs.webob.org/en/latest/file-example.html . I also borrowed from Paste’s StaticURLParser and static.Cling.
In addition there is a command line script, serve, which may be used to serve a directory with the wsgiref server.
Tests
doctests and a test runner, test.py, exist in the tests/ subdirectory of http://k0s.org/hg/FileServer . I currently use paste.fixture.TestApp to mock requests and inspect responses, but should probably move to WebTest .
Other Projects
While I didn’t find them suitable for my use, there are other standalone static fileservers available for python:
Paste StaticURLParser
Jeff Hammel
Metadata
Release files for FileServer 0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| FileServer-0.3.tar.gz | 4.5 kB | Without provenance | Details for FileServer-0.3.tar.gz |
Release files / FileServer-0.3.tar.gz
| Download URL | FileServer-0.3.tar.gz |
|---|---|
| Size | 4.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ed733028766915f794544dfe4af8b3824ddc7c2d072ee5f18e4e4fd0ddbb486a
|
|
BLAKE2b-256 checksum How to use checksums |
4ee5b80f4a307e67dab2b770f3f49af3cd67ad8269356b6df08a19dca3605fbf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for FileServer 0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.