Pre-release
This release is a pre-release and may not be stable for production use.
fooster-web
fooster-web is a small, process-pooled web server utilizing the built-in Python socketserver. It is designed from the ground up to be well structured, to conform to the HTTP/1.1 standard, and to allow for easy creation of a RESTful interface.
Usage
Below is a basic example that stores data via a PUT method and retrieves data via a GET method on any resource. If a resource has not been set, it returns a 404 error.
import fooster.db
import fooster.web
data = fooster.db.Database('data.db', ['path', 'body'])
class Handler(fooster.web.HTTPHandler):
def do_get(self):
try:
return 200, data[self.groups['path']].body
except KeyError:
raise fooster.web.HTTPError(404)
def do_put(self):
data[self.groups['path']] = data.Entry(self.request.body.decode())
return 200, 'Accepted\n'
def do_delete(self):
try:
del data[self.groups['path']]
except KeyError:
raise fooster.web.HTTPError(404)
return 200, 'Deleted\n'
routes = {r'/(?P<path>.*)': Handler}
if __name__ == '__main__':
import signal
httpd = fooster.web.HTTPServer(('localhost', 8000), routes)
httpd.start()
signal.signal(signal.SIGINT, lambda signum, frame: httpd.close())
httpd.join()
Examples and more information are available at the wiki.
Release files for fooster-web 0.4.0rc1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| fooster-web-0.4.0rc1.tar.gz | 21.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fooster_web-0.4.0rc1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size:46.5 kB
Release files / fooster-web-0.4.0rc1.tar.gz
| Download URL | fooster-web-0.4.0rc1.tar.gz |
|---|---|
| Size | 21.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ca5a0c1c461f13a3a0c2fbc8f5df9f42242ea808c8e020f7a42815125d45c6b0
|
|
BLAKE2b-256 checksum How to use checksums |
18c37a936410c2b2802c62fa20254ff8355950e5a8be1711a1d00a57c4a0acc4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.9.0
|
Release files / fooster_web-0.4.0rc1-py3-none-any.whl
| Download URL | fooster_web-0.4.0rc1-py3-none-any.whl |
|---|---|
| Size | 24.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
461317225f7a9d416385d0c7b8c82470883b4a67bc99be921c6dbdb38e4df296
|
|
BLAKE2b-256 checksum How to use checksums |
f3ec47bb86ebac4a726c18f5a842214f431ccfe6e90e290ee8152e6138a5d51c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.9.0
|