Flask-RESTly
Quick start
pip install flask-restly
By default flask-restly uses JSON serializer.
from flask import Flask
from flask_restly import FlaskRestly
from flask_restly.decorator import resource, get, delete
app = Flask(__name__)
rest = FlaskRestly(app)
rest.init_app(app)
@resource(name='employees')
class EmployeesResource:
@get('/<id>')
def get_employee(self, id):
return dict(id=int(id))
@get('/')
def get_employees(self):
return dict(entites=[
dict(id=1),
dict(id=2)
])
@delete('/<id>')
def delete_employee(self, **kwargs):
return
with app.app_context():
EmployeesResource()
if __name__ == "__main__":
app.run(host='127.0.0.1', port=5001, debug=True)
$ python main.py
* Serving Flask app "main" (lazy loading)
* Environment: production
WARNING: Do not use the development server in a production environment.
Use a production WSGI server instead.
* Debug mode: on
* Restarting with stat
* Debugger is active!
* Debugger PIN: 210-167-642
* Running on http://127.0.0.1:5001/ (Press CTRL+C to quit)
Features
- Decorators-based routing
- JSON and Protobuf built-in serialization
- Custom serializer support
- Authorization and authentication decorators
- Automatic REST-like response codes
- API versioning
- Rating limits
Todo
- HATEOAS/HAL
Usage
Please see examples for more details.
Settings
| Name | Default value |
|---|---|
RESTLY_SERIALIZER: <flask_restly.serializer.SerializerBase> |
flask_restly.serializer.json |
RESTLY_API_PREFIX: <str> |
/api/rest |
RESTLY_PROTOBUF_MIMETYPE: <str> |
application/x-protobuf |
RESTLY_RATE_LIMIT_REQUESTS_AMOUNT: <int> |
100 |
RESTLY_RATE_LIMIT_WINDOW_SECONDS: <int> |
60 |
Docs
Metadata
Release files for flask-restly 1.1.0
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-restly-1.1.0.tar.gz | 13.4 kB | Without provenance | Details for flask-restly-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| flask_restly-1.1.0-py3-none-any.whl | Python 3 | none | any | Details for flask_restly-1.1.0-py3-none-any.whl |
Total release size: 30.6 kB
Release files / flask-restly-1.1.0.tar.gz
| Download URL | flask-restly-1.1.0.tar.gz |
|---|---|
| Size | 13.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6afb633558794f030e0c87d1c7eb8cc4b93cbe79a3d2fe2cdb6f87ec69e457b5
|
|
BLAKE2b-256 checksum How to use checksums |
575367531c77f1d183d021b753577d33c1e716daed3d442697da6bd3d080ab1c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.3
|
Release files / flask_restly-1.1.0-py3-none-any.whl
| Download URL | flask_restly-1.1.0-py3-none-any.whl |
|---|---|
| Size | 17.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b356b0586a6a16027e679fee6fe3e5c8218fa1b8110adcaec0d16a99a645bc38
|
|
BLAKE2b-256 checksum How to use checksums |
845fd0a1eac341dfaa59081b3a845bf785639cf768935d479ff95b47c41dd2a0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.3
|
Security for flask-restly 1.1.0
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.