Pyndatic Webargs
A library for parsing and validating http requests for flask web-framework using pydantic library
Full documentation here
Requirements
python >= 3.7
How to install
pip install pydantic-webargs
Dependencies
flask
pydantic
Example
from flask import Flask
from pydantic import BaseModel
from pydantic_webargs import webargs
app = Flask(__name__)
class QueryModel(BaseModel):
name: str
class BodyModel(BaseModel):
age: int
@app.route("/get-request", methods=["GET"])
@webargs(query=QueryModel)
def example_get_endpoint(**kwargs):
response = kwargs
return response
@app.route("/post-request", methods=["POST"])
@webargs(query=QueryModel, body=BodyModel)
def example_post_endpoint(**kwargs):
print(kwargs)
response = kwargs
return response
if __name__ == "__main__":
app.run(host="0.0.0.0", port=8000)
Metadata
Release files for pydantic-webargs 1.1.0
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 |
|---|---|---|---|---|
| pydantic_webargs-1.1.0.tar.gz | 3.2 kB | Without provenance | Details for pydantic_webargs-1.1.0.tar.gz |
Release files / pydantic_webargs-1.1.0.tar.gz
| Download URL | pydantic_webargs-1.1.0.tar.gz |
|---|---|
| Size | 3.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bd74d84e4a1956cd2ce3ba5957c6f652cde861f44c2c9927fe5b8b011c29e713
|
|
BLAKE2b-256 checksum How to use checksums |
86fe4a7607a2fe487304ada95523aee040cc40bb39d624192f08e6375f5fd88b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/1.7.0 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.12
|
Security for pydantic-webargs 1.1.0
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.