Skip to main content

flask-dataapi

Automatically generate data APIs for your Flask routes, with very little effort on your part. It should integrate into your existing application with very few changes required.

Usage

Given the following code:

from flask import Flask

app = Flask(__name__)

@app.route('/foo')
def foo():
    return render_template('foo.html', foo='bar', baz='boo')

We can automatically generate API functions for this route, rather simply:

from flask import Flask
from flask_dataapi import DataApi

app = Flask(__name__)
api = DataApi(app)

@api.route('/foo')
def foo(render_template):
    return render_template('foo.html', foo='bar', baz='boo')

There are only two changes made. First, we call api.route for the decorator, and second, the first argument to the view function is the render_template function that we’ll call.

This will automatically add a second route of /foo.json that outputs JSON of the data that was provided to render_template. The route will have a name of foo_api, so links or other references will use that name, e.g. url_for('foo_api').

Motivation

In addition to free code, we also need free data. This makes it trivial to ensure that all data presented to users is easily extractable by the user.

License

flask-dataapi is available under the terms of the AGPL, version 3 or any later version.

Release files for flask-dataapi 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for flask-dataapi 0.2.1
File Size Uploaded
flask_dataapi-0.2.1.tar.gz 14.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for flask-dataapi 0.2.1
File Interpreter ABI Platform
flask_dataapi-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 29.6 kB

Release files / flask_dataapi-0.2.1.tar.gz

Download URL flask_dataapi-0.2.1.tar.gz
Size 14.4 kB
Tags Source
SHA-256 checksum
How to use checksums
e20cf7237854d9a90d7decef2360a66c713e4545773ea5166a67a6309a2001e3
BLAKE2b-256 checksum
How to use checksums
77f34e174d485d84ac232e90155ba6f45e89d90c1e7d7370a088f4d90cb82ca5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.2 pkginfo/1.4.2 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.37.0 CPython/3.7.6

Release files / flask_dataapi-0.2.1-py3-none-any.whl

Download URL flask_dataapi-0.2.1-py3-none-any.whl
Size 15.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ed9181ea90556e5282db2a53c9b7a2832c8b30ccd0c9f3fba2fa82237b6b1526
BLAKE2b-256 checksum
How to use checksums
fc7f9a2ced425acad41af242ab9b9a202997125843a15b10c934948d49b2fc2b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.2 pkginfo/1.4.2 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.37.0 CPython/3.7.6

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page