Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/corydolphin/flask-headers
Adding headers to your flask application since...
https://github.com/corydolphin/flask-headers
Last synced: 19 days ago
JSON representation
Adding headers to your flask application since...
- Host: GitHub
- URL: https://github.com/corydolphin/flask-headers
- Owner: corydolphin
- License: mit
- Created: 2014-01-08T04:45:37.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2014-01-08T06:56:54.000Z (almost 11 years ago)
- Last Synced: 2024-12-03T04:47:55.606Z (19 days ago)
- Language: Python
- Size: 176 KB
- Stars: 7
- Watchers: 2
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# flask-headers
flask-headers is a simple extension to Flask allowing you decorate routes
in order to send headers.[![Build Status](https://travis-ci.org/wcdolphin/flask-headers.png?branch=master)](https://travis-ci.org/wcdolphin/flask-headers)
## Installation
Install the extension with using pip, or easy_install.
```bash
$ pip install flask-headers
```## Usage
This extension exposes a simple decorator to decorate flask routes with. Simply
add `@headers(foo=bar)` below a call to Flask's `@app.route(..)` incanation to
add the header `foo` with the value `bar` to all responses from the given route.### Simple Usage
```python
@app.route("/")
@headers({'Cache-Control':'public, max-age=30'})
def cacheable():
return '''Hello Flask-Headers!
Checkout my documentation
on Github'''```
For a full list of options, please see the full [documentation](http://flask-headers.readthedocs.org/en/latest/)
## Tests
A simple set of tests is included in `test.py`. To run, install nose, and simply invoke `nosetests` or run `python test.py` to exercise the tests.## Contributing
Questions, comments or improvements? Please create an issue on Github, tweet at me or send me an email.[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/wcdolphin/flask-headers/trend.png)](https://bitdeli.com/free "Bitdeli Badge")