airflow-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bolke de Bruin <bdbr...@gmail.com>
Subject Re: CSRF token issue when using POST in flask_blueprints in the Plugin
Date Mon, 29 Aug 2016 17:06:00 GMT
Add @csrf.exempt 

http://flask-wtf.readthedocs.io/en/latest/csrf.html

Bolke

Sent from my iPhone

> On 29 aug. 2016, at 14:25, Dmitriy Krasnikov <dkrasnikov@hotmail.com> wrote:
> 
> 
> 
> 
> 
> Hi, I was trying to ask this question on Stackoverflow, but I don't think anybody monitors
it.
> 
> I am trying to leverage plugins in airflow to implement REST calls to meta database.
I created new tables, but while GET works fine, the POST and PUT generate CSRF token missing
or incorrect error.
> 
> from airflow.plugins_manager import AirflowPlugin  
> from flask import Blueprint
> asset = Blueprint('turbine_plugin', __name__, url_prefix='/api/asset')
> 
> @asset.route('/', methods=['POST'])
> def insert():
>     """
>     Inserts new Asset.
>     :return: 200 on success.
>     """
>     pass
> 
> class TurbinePlugin(AirflowPlugin):
>     name = "turbine_plugin"
>     flask_blueprints = [asset]
> 
> 
> what should I include or do to use POST in ariflow plugins, I see in code that app is
CSRF protected, but how you get token for REST calls?
> 

Mime
View raw message