# dsrw
Dead simple restful wsgi applications
# Installation
```pip install dsrw```
# Usage
```python
from wsgiref.simple_server import make_server
from dsrw import App, Request
app = App()
api = app.ns('/api')
@app.get('/hello')
def hello(req: Request):
return {'msg': "Hello world!"}
@app.get('/hello/:name')
def other(req: Request):
return {'msg': 'Hello',
'name': req.param.name}
@api.get('/echo')
def echo(req: Request):
if req.has_valid_body:
return req.body
else:
return ["No body available"]
if __name__ == '__main__':
httpd = make_server('', 8080, app)
print("Serving HTTP on port 8080...")
# Respond to requests until process is killed
httpd.serve_forever()
```
# Todo
- Middleware
Dead simple restful wsgi applications
# Installation
```pip install dsrw```
# Usage
```python
from wsgiref.simple_server import make_server
from dsrw import App, Request
app = App()
api = app.ns('/api')
@app.get('/hello')
def hello(req: Request):
return {'msg': "Hello world!"}
@app.get('/hello/:name')
def other(req: Request):
return {'msg': 'Hello',
'name': req.param.name}
@api.get('/echo')
def echo(req: Request):
if req.has_valid_body:
return req.body
else:
return ["No body available"]
if __name__ == '__main__':
httpd = make_server('', 8080, app)
print("Serving HTTP on port 8080...")
# Respond to requests until process is killed
httpd.serve_forever()
```
# Todo
- Middleware
Metadata
Release files for dsrw 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dsrw-0.1.4.tar.gz | 4.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dsrw-0.1.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.8 kB
Release files / dsrw-0.1.4.tar.gz
| Download URL | dsrw-0.1.4.tar.gz |
|---|---|
| Size | 4.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4c0ef48228cd4c9d0dd216a3bbc75220d8bf9e4bd49c9e1b518bf3b2049e6ce3
|
|
BLAKE2b-256 checksum How to use checksums |
cd55ba0c3ffd8de6c21f6fb14bd2e86d427ff35e55c71a9b503fcbbc5068fab8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / dsrw-0.1.4-py3-none-any.whl
| Download URL | dsrw-0.1.4-py3-none-any.whl |
|---|---|
| Size | 6.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dadba88f96ef0bee469083e8acf4119cc916c6562b3473920f4e33149449af04
|
|
BLAKE2b-256 checksum How to use checksums |
419d4d94c274c5962e91a882d64bc4d6ef3f05640603d575241e5500d84f9c5c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |