Security News
Introducing the Socket Python SDK
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Flask Ninja is a web framework for building APIs with Flask and Python 3.9+ type hints.
Flask Ninja is a web framework for building APIs with Flask and Python 3.9+ type hints.
Key features:
For mode details, see the Documentation
pip install flask-ninja
In your flask project where you create flask app:
from flask import Flask
from flask_ninja import NinjaAPI
from pydantic import BaseModel
app = Flask(__name__)
api = NinjaAPI(app)
class Response(BaseModel):
"""Response model containing results of various number operations."""
sum: int
difference: int
product: int
power: int
@api.get("/compute")
def compute(a: int, b: int) -> Response:
"""Computes results of various number operations.
This endpoint returns a result of the following operations:
- sum
- difference
- product
- power
:param int a: First number
:param int b: Second number number
"""
return Response(
sum=a + b,
difference=a - b,
product=a * b,
power=a ** b
)
if __name__ == "__main__":
app.run()
That's it !
Now you've just created an API that:
/compute
a
and b
Now go to http://127.0.0.1:5000/docs
You will see the automatic interactive API documentation (provided by Swagger UI):
FAQs
Flask Ninja is a web framework for building APIs with Flask and Python 3.9+ type hints.
We found that flask-ninja demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.
Security News
A new Rust RFC proposes "Trusted Publishing" for Crates.io, introducing short-lived access tokens via OIDC to improve security and reduce risks associated with long-lived API tokens.