Skip to main content

Pydatic webargs

Project description

Pyndatic Webargs

CircleCI codecov GitHub Pipenv locked Python version Downloads license

A library for parsing and validating http requests for flask web-framework using pydantic library

Full documentation here


python >= 3.7

How to install

pip install pydantic-webargs




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"])
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):
    response = kwargs
    return response

if __name__ == "__main__":"", port=8000)

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

pydantic_webargs-1.0.1.tar.gz (2.7 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page