thisissoon / Flask-HAL

Flask Extension to easily add support for REST HATEOAS via the HAL Specification: https://tools.ietf.org/html/draft-kelly-json-hal-07

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Flask-HAL

circle downloads version license docs

Hello Dave...

I provide easy integration of the HAL specification for your REST Flask Applications.

Here is an example Dave...

# Third Party Libs
from flask import Flask

# First Party Libs
from flask_hal import HAL, document


app = Flask(__name__)
HAL(app)  # Initialise HAL


@app.route('/hello')
def hello():
    return document.Document(data={
        'message': 'Hello World'
    })


if __name__ == "__main__":
    app.run(debug=True)

Here is the response from the above view.

HTTP/1.1 200 OK
Content-Type: application/hal+json; charset=UTF-8
Date: Thu, 06 Aug 2015 10:24:04 GMT

{
    "_links": {
        "self": {
            "href": "/hello"
        },
    },
    "foo": "bar"
}

## Contributing

Run tests using python setup.py test.

About

Flask Extension to easily add support for REST HATEOAS via the HAL Specification: https://tools.ietf.org/html/draft-kelly-json-hal-07

License:The Unlicense


Languages

Language:Python 97.2%Language:Makefile 2.6%Language:Shell 0.2%