Skip to main content

flask-typed

A Flask extension for developing HTTP APIs using type annotations. Type annotations are used for the validation of requests and generating API documentation.

Example

from flask import Flask
from pydantic import BaseModel

from flask_typed import TypedResource, TypedAPI


class HelloResponse(BaseModel):

    message: str
    sender: str
    receiver: str


class HelloResource(TypedResource):

    def get(self, sender: str, receiver: str) -> HelloResponse:
        """
        Greets someone

        :param sender: Greeter
        :param receiver: The one being greeted
        :return: Greetings
        """
        return HelloResponse(
            message=f"Hello to {receiver} from {sender}!",
            sender=sender,
            receiver=receiver
        )


app = Flask(__name__)
api = TypedAPI(app, version="1.0", description="Greetings API")

api.add_resource(HelloResource, "/hello/<sender>")

if __name__ == "__main__":
    app.run()

Release files for flask-typed 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for flask-typed 0.2.1
File Size Uploaded
flask_typed-0.2.1.tar.gz 9.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for flask-typed 0.2.1
File Interpreter ABI Platform
flask_typed-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 23.3 kB

Release files / flask_typed-0.2.1.tar.gz

Download URL flask_typed-0.2.1.tar.gz
Size 9.8 kB
Tags Source
SHA-256 checksum
How to use checksums
255a53cc7caf44ea7afc0910204337a1620dea1f6792a65bba33fd8fed4bb9c6
BLAKE2b-256 checksum
How to use checksums
24529ae754d86d57b5f3b2bfe2e391da1c21f5c97374fd494c9fb4e1cf9122f9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.2 CPython/3.11.8 Linux/6.8.1-arch1-1

Release files / flask_typed-0.2.1-py3-none-any.whl

Download URL flask_typed-0.2.1-py3-none-any.whl
Size 13.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fa889fcd24c8b99f70dc1869761e376684d615545db9ff7fa1a7812e6a170617
BLAKE2b-256 checksum
How to use checksums
103c8a52d3528e6aef6c90b58ef853b0814ff7c960d94641ddcc487485d12e7a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.2 CPython/3.11.8 Linux/6.8.1-arch1-1
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page