Skip to main content

Framework providing REST JSON API to Tornado web server

Project description

Tornado_jsonapi

Build Status Coverage Status Requirements Status PyPi version Documentation Status GitHub License

Tornado_jsonapi is a Python 3.3+ library for creating JSON API (as per jsonapi.org specification) using Tornado web framework. It features

  • semi-automatic API generation using provided JSON schema of resource;
  • support for arbitrary data sources, including SQLAlchemy and PostgreSQL (via DBAPI2 support layer);
  • support for asynchronous data source operations;
  • strict jsonapi.org specification conformance.

Usage

import sqlite3
import tornado.ioloop
import tornado.web
import tornado_jsonapi.handlers
import tornado_jsonapi.resource

schema = {
    "title": "post",
    "properties": {
        "text":
        {
            "type": "string"
        },
        "author":
        {
            "type": "string"
        }
    }
}

res = tornado_jsonapi.resource.DBAPI2Resource(
    schema, sqlite3, sqlite3.connect(':memory:'))
res._create_table()

application = tornado.web.Application([
    (
        r"/api/posts/([^/]*)",
        tornado_jsonapi.handlers.APIHandler,
        dict(resource=res)
    )
])
application.listen(8888)
tornado.ioloop.IOLoop.current().start()

Installation

$ pip install tornado_jsonapi

Roadmap

a.k.a. TODO

  • improve documentation :pensive:
  • automatic API doc generation based on JSON schema;
  • MongoDB/Motor support;
  • support for API testing.

License

This project is licensed under the MIT License.

Changelog

0.1.4 (2020-01-24)

  • Added support for column blacklisting and pagination, thanks to Zachary Gorak.

0.1.3 (2016-04-07)

  • Fixed incompatibility with latest python-jsonschema-objects
  • Updated obsolete requirements
  • Adjusted supported Python versions

0.1.2 (2016-04-07)

  • Fixed dependencies issue preventing installation in environment with LANG=C

0.1.0 (2016-03-21)

  • First release.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for tornado-jsonapi, version 0.1.4
Filename, size File type Python version Upload date Hashes
Filename, size tornado_jsonapi-0.1.4-py3-none-any.whl (12.3 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size tornado_jsonapi-0.1.4.tar.gz (16.1 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page