Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

Dead simple restful wsgi applications

Project description

# 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


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for dsrw, version 0.1.4
Filename, size File type Python version Upload date Hashes
Filename, size dsrw-0.1.4-py3-none-any.whl (6.9 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size dsrw-0.1.4.tar.gz (4.9 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page