Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Flask-RESTAPI is an extension for Flask that is a database-agnostic framework library for creating REST APIs. It is a lightweight abstraction that works with your existing ORM/libraries.
It use pydantic to validate and serialize data. OpenAPI document can be automatically generated through the python decorator and it supports swagger ui display.
Pydantic are used to validate and serialize parameters. For details, please refer to the pydantic documentation.
pip install flask-restapi
from flask import Flask
from flask.views import MethodView
from pydantic import BaseModel
from flask_restapi import Api, RequestParametersType
app = Flask(__name__)
api = Api(app)
class UserGetSpec(BaseModel):
name: str
class UserResponseSpec(BaseModel):
id: int
name: str
class User(MethodView):
@api.query(UserGetSpec)
@api.response(UserResponseSpec)
def get(self, parameters: RequestParametersType):
"""Get a user name and id"""
user_name = parameters.query.name
return UserResponseSpec(id=1, name=user_name)
app.add_url_rule("/user", view_func=User.as_view("user"))
Now go to http://localhost:5000/docs
FAQs
Flask-RESTAPI is an extension for validate and make OpenAPI docs.
We found that flask-restapi 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.