Route DSL
Project description
Python eDSL for your Web Routes
pip install routedsl
Compose everything in one place
routes = Routes() (
GET / 'users' / ('user_id', User, "User identifier")
| HEADERS | Headers
| RETURNS | JSON [ User ]
| HANDLER | get_user_info
| GUARDS | ( Headers.content_type | IS | 'application/json'
)
| DOCS | """Get a user profile in JSON format"""
)(
POST / 'users' / ('user_id', User)
| HEADERS | Headers
| PAYLOAD | JSON [ User ]
| RETURNS | OK [ JSON [ bool ] ]
| HANDLER | update_user_info
)
or define pieces separately, then assemble your routing map:
DefaultHeaders = HEADERS | Headers
DefaultHandler = HANDLER | default_handler
DefaultEndpoint = GET / DefaultHeaders
| DefaultHandler
routes = Routes() | DefaultEndpoint
Use nesting under common prefix
routes = (routes / 'users' / ('user_id', User)) (
POST / 'edit'
| HEADERS | Headers
| RETURNS | JSON [ User ]
| HANDLER | update_user_info
)
Read more in Official Documentation.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
routedsl-0.0.1.tar.gz
(5.2 kB
view details)
Built Distribution
File details
Details for the file routedsl-0.0.1.tar.gz
.
File metadata
- Download URL: routedsl-0.0.1.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0.post20200311 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 97bb12f3a561bf9c7ff56e4519f9e9c448c73ba7c7eac705e30532c826c9e648 |
|
MD5 | d9e2495d47b0a63c7274a907e9e0541d |
|
BLAKE2b-256 | d8f95c2da252a660225e1818208b91608c8689abd1bde094d827630ab5551332 |
File details
Details for the file routedsl-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: routedsl-0.0.1-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0.post20200311 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 11496ea5d9303fc205f38e4b757f76d8f48f3c702fc88a8bc913d9613eb5e1f0 |
|
MD5 | be555784154d11e1f8d1910804282a32 |
|
BLAKE2b-256 | 6aff35b334327ea70f55302cd96b8d2bedf3e07aae39a6bc070a41cc3eba28f4 |