py-jsonapi-flask
This extension connects your Flask application with py-jsonapi.
Installation
You can install this extension via PyPi:
$ pip3 install py-jsonapi-flask
How to
You can use py-jsonapi-flask like every other Flask extension:
from flask import Flask
from jsonapi_flask.api import API
app = Flask(__name__)
api = API("/api", flask_app=app)
You can also register the extension later via init_app():
api.init_app(app)
In these examples, the API will take control over all urls starting with
/api/
.
current_api
You can access the current API via the extensions dictionary of the flask application:
app.extensions["jsonapi"]
or you use the global variable current_api
:
from jsonapi_flask.api import current_api
The API instance is also added to the jinja environment:
<p>
You can download your profile
<a href="{{ jsonapi.resource_uri(current_user) }}">
here
</a>
</p>
current_request
You can also access the current py-jsonapi request object:
from jsonapi_flask.api import current_request
The request is also added to the jinja environment under the name jsonapi_request.
License
This library is licensed under the MIT License.
Contributions and questions
Contributions are always welcome. If you have a question, don't hesitate to open a new issue.
Version numbers
We will use semantic version numbers, starting with the first release.