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

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


Download files

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

Files for flask-required-args, version 1.0.0
Filename, size File type Python version Upload date Hashes
Filename, size flask_required_args-1.0.0-py3-none-any.whl (4.5 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size flask_required_args-1.0.0.tar.gz (2.6 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