Skip to main content

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.

Source Distribution

flask_required_args-1.0.0.tar.gz (2.6 kB view details)

Uploaded Source

Built Distribution

flask_required_args-1.0.0-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file flask_required_args-1.0.0.tar.gz.

File metadata

  • Download URL: flask_required_args-1.0.0.tar.gz
  • Upload date:
  • Size: 2.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for flask_required_args-1.0.0.tar.gz
Algorithm Hash digest
SHA256 236d83be7d23de96f733b366b87491eb06848ffb0e54789884817241fb0479e5
MD5 5bc615ccdc51f73221986fd4b082da15
BLAKE2b-256 3c5becd69180bb5dd7c85202eaa2bf97cebf9ccfa00b2c15085175d64b7d8eb1

See more details on using hashes here.

File details

Details for the file flask_required_args-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: flask_required_args-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for flask_required_args-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f5788edfcf47a59cbec9dd9b39faebaa2822b7448b7d07591848e68a62f8f683
MD5 ea2dc09b2c2c5f86d6ec77e7e0b1ec64
BLAKE2b-256 86d395446f4b1c18d69403f125020f0c6867eaa74553637807f2417f412a162e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page