Upgrade your flask application by defining required arguments
Project description
Flask Required Args
A simple flask decorator that helps specify which args are required from the user. It returns a 400 error if any are missing. You specify the arguments required in your function definition, you can use default parameters like normal.
Installation
pip install flask_required_args
Example Usage
Simple usage
from flask_required_args import required_data
@app.route('/', methods=['POST'])
@required_data
def hello_world(name):
return f'Hello {name}'
You can use default parameters as normal
from flask_required_args import required_data
@app.route('/', methods=['POST'])
@required_data
def hello_world(name="World"):
return f'Hello {name}'
You can use url parameters as normal
from flask_required_args import required_data
@app.route('/<user_name>', methods=['POST'])
@required_data
def hello_world(greeting, user_name):
return f'{greeting} {user_name}'
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
Built Distribution
Close
Hashes for flask_required_args-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 236d83be7d23de96f733b366b87491eb06848ffb0e54789884817241fb0479e5 |
|
MD5 | 5bc615ccdc51f73221986fd4b082da15 |
|
BLAKE2b-256 | 3c5becd69180bb5dd7c85202eaa2bf97cebf9ccfa00b2c15085175d64b7d8eb1 |
Close
Hashes for flask_required_args-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f5788edfcf47a59cbec9dd9b39faebaa2822b7448b7d07591848e68a62f8f683 |
|
MD5 | ea2dc09b2c2c5f86d6ec77e7e0b1ec64 |
|
BLAKE2b-256 | 86d395446f4b1c18d69403f125020f0c6867eaa74553637807f2417f412a162e |