Skip to main content

No project description provided

Project description

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()

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_typed-0.2.3.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flask_typed-0.2.3-py3-none-any.whl (13.8 kB view details)

Uploaded Python 3

File details

Details for the file flask_typed-0.2.3.tar.gz.

File metadata

  • Download URL: flask_typed-0.2.3.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.12.6 Linux/6.10.10-arch1-1

File hashes

Hashes for flask_typed-0.2.3.tar.gz
Algorithm Hash digest
SHA256 27864392c7efb4aab0f0ef29706620b255d4c275aa184eb47a02ae58fac99bf6
MD5 ad42fa26cf0de6d1463f7263252c7149
BLAKE2b-256 6c24098cbacf79ba49676540dbad28b5006f647c77eb2b6c1f7eb615ee56b2f1

See more details on using hashes here.

File details

Details for the file flask_typed-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: flask_typed-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 13.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.12.6 Linux/6.10.10-arch1-1

File hashes

Hashes for flask_typed-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f89dd85f3808fb488de1f207960d1a659a491cbb9b81ce29f8ee54bb50fea344
MD5 f99bb4e55a4e406761d8c2b49960bf6e
BLAKE2b-256 79aaf42e0fb665cfdf679f81d3c2ed5c8bb22a593c217173b6c3f0433efe1def

See more details on using hashes here.

Supported by

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