flask_verify
A python package to verify the content of Requests and convert the return values of view functions in Flask applications.
Installation
You can install flask_verify
pip install flask_verify
Example
Consider this minimal example, where Message is a simple dataclass.
from flask_verify.verify_json import verify_json_route
from flask import Flask, request
app = Flask(__name__)
@app.route('/example', methods=['POST'])
@verify_json_route(must_contain=('message', 'username'))
def example_route():
message = Message(request.json['username'], request.json['message'])
return message, 200
Just by writing a single decorator statement, we have:
- Ensured that the
Requestis of typeapplication/jsonand contains keysmessageandusername, if this is not true, our server will respond with a 400 status code Response explaining the issue to the server, including the name of the first missing key if that exists. - Converted the return type to JSON,
messageobject is an instance of theMessagedataclass, thanks to our decorator, the Response will automatically be converted to a JSON containing the field names and values of the dataclass instance.
Metadata
Release files for flask_verify 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| flask_verify-0.1.2.tar.gz | 25.3 kB | Without provenance | Details for flask_verify-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| flask_verify-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for flask_verify-0.1.2-py3-none-any.whl |
Total release size: 29.8 kB
Release files / flask_verify-0.1.2.tar.gz
| Download URL | flask_verify-0.1.2.tar.gz |
|---|---|
| Size | 25.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ac08b3710557b881863d2e129c4c2997ef5563de467364115ee0729686bbbabd
|
|
BLAKE2b-256 checksum How to use checksums |
d45a832c3772863eb7a035707d08715e39abb286a68f8aa778598fcf95b47e5c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.25.1
|
Release files / flask_verify-0.1.2-py3-none-any.whl
| Download URL | flask_verify-0.1.2-py3-none-any.whl |
|---|---|
| Size | 4.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e945dfeb6840d14aec51a5152c90d17755800b92355612ad9139be01753dc0e5
|
|
BLAKE2b-256 checksum How to use checksums |
0891b32c540170e1b617557ed6abc929669b3e44ddfe6ec2d58886389a2b511c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.25.1
|
Security for flask_verify 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.