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.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| flask_typed-0.2.3.tar.gz | 9.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| flask_typed-0.2.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 23.7 kB
Release files / flask_typed-0.2.3.tar.gz
| Download URL | flask_typed-0.2.3.tar.gz |
|---|---|
| Size | 9.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
27864392c7efb4aab0f0ef29706620b255d4c275aa184eb47a02ae58fac99bf6
|
|
BLAKE2b-256 checksum How to use checksums |
6c24098cbacf79ba49676540dbad28b5006f647c77eb2b6c1f7eb615ee56b2f1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.4 CPython/3.12.6 Linux/6.10.10-arch1-1
|
Release files / flask_typed-0.2.3-py3-none-any.whl
| Download URL | flask_typed-0.2.3-py3-none-any.whl |
|---|---|
| Size | 13.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f89dd85f3808fb488de1f207960d1a659a491cbb9b81ce29f8ee54bb50fea344
|
|
BLAKE2b-256 checksum How to use checksums |
79aaf42e0fb665cfdf679f81d3c2ed5c8bb22a593c217173b6c3f0433efe1def
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.4 CPython/3.12.6 Linux/6.10.10-arch1-1
|