Flask-Viewsets
Flask-Viewsets is a Python package that provides a ViewSet class, inheriting from Flask's View, inspired by Django REST Framework's ViewSet. This package aims to streamline the development of RESTful APIs in Flask by offering a simple and flexible class-based view structure for mapping HTTP methods to defined actions on a per route basis.
Features
- Provides an easy-to-use class-based view to manage HTTP methods.
- Supports all HTTP methods (
GET,POST,PUT,PATCH,DELETE, ...). - Extensible and customizable for various use cases.
Installation
You can install Flask-Viewsets using pip:
pip install Flask-Viewsets
Usage
To use the ViewSet class, import it in your Flask application, define a viewset class by inheriting ViewSet, and implement the desired HTTP methods. Here’s a simple example:
# views.py
from flask_viewsets import ViewSet
class ExampleViewSet(ViewSet):
def hello(self):
return "Hello, world!"
def echo(self, message: str):
return message
# app.py
from flask import Flask
from . import views
app = Flask(__name__)
app.add_url_rule('/hello', view_func=views.ExampleViewSet.as_view({
"get": "hello"
}))
app.add_url_rule('/echo/<string:message>', view_func=views.ExampleViewSet.as_view({
"get": "echo"
}))
if __name__ == "__main__":
app.run(debug=True)
Requirements
- Python ^3.12
- Flask ^3.0.3
Contributing
Contributions are welcome! Please feel free to submit a pull request, file an issue, or suggest improvements.
License
This project is licensed under the GNU Affero General Public License. See the LICENSE.md file for details.
Enjoy using Flask-Viewsets? Give it a star and help make Flask development easier!
Metadata
Release files for Flask-Viewsets 0.2.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| flask_viewsets-0.2.6.tar.gz | 19.7 kB | Without provenance | Details for flask_viewsets-0.2.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| flask_viewsets-0.2.6-py3-none-any.whl | Python 3 | none | any | Details for flask_viewsets-0.2.6-py3-none-any.whl |
Total release size: 40.8 kB
Release files / flask_viewsets-0.2.6.tar.gz
| Download URL | flask_viewsets-0.2.6.tar.gz |
|---|---|
| Size | 19.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4cbdfa0351387d8e903ed40c2c03f9f63e33e31192f2bd049f010401129e0873
|
|
BLAKE2b-256 checksum How to use checksums |
5433cdaf631688bf32aefb17db2a3cc4bbdcf70f03fc425f14b8391a0eccfdaa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.11.2 Linux/5.15.153.1-microsoft-standard-WSL2
|
Release files / flask_viewsets-0.2.6-py3-none-any.whl
| Download URL | flask_viewsets-0.2.6-py3-none-any.whl |
|---|---|
| Size | 21.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
db9a18805b6f8bb630b389013d569b14b7f69e43703d08ee6b80b792b4f577ab
|
|
BLAKE2b-256 checksum How to use checksums |
dfeb8d0d5fc9d60fa1070db7d3059bda0462b1a543a5bf81d15707e6c654603a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.11.2 Linux/5.15.153.1-microsoft-standard-WSL2
|
Security for Flask-Viewsets 0.2.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.