# -*- coding: utf8 -*-
VERSION = (0, 1, 0)
__author__ = 'Vincent Lara'
__contact__ = "vincent.lara@data.gouv.fr"
__homepage__ = "https://github.com/"
__version__ = ".".join(map(str, VERSION))


from flask import Flask
from flask.ext.security import Security, SQLAlchemyUserDatastore
from flask.ext.script import Manager
from flask.ext.security.utils import verify_and_update_password
from flask_bootstrap import Bootstrap
import os
from models import db
from models import security as security_models, taxis as taxis_models,\
    administrative as administrative_models

app = Flask(__name__)
app.config.from_object('default_settings')
if 'BO_OPERATEURS_CONFIG_FILE' in os.environ:
    app.config.from_envvar('BO_OPERATEURS_CONFIG_FILE')

db.init_app(app)

user_datastore = SQLAlchemyUserDatastore(db, security_models.User,
                            security_models.Role)
security = Security(app, user_datastore)
from views import ads
from views import conducteur
from views import zupc
from views import home

app.register_blueprint(ads.mod)
app.register_blueprint(conducteur.mod)
app.register_blueprint(zupc.mod)
app.register_blueprint(home.mod)

@app.login_manager.request_loader
def load_user_from_request(request):
    auth = request.headers.get('Authorization')
    if not auth:
        return None
    auth_splitted = auth.split(':')
    if len(auth_splitted) != 2:
        return None
    login, password = auth_splitted
    user = user_datastore.get_user(login.strip())
    if user is None:
        return None
    if not verify_and_update_password(password.strip(), user):
        return None
    if not user.is_active():
        return None
    return user





Bootstrap(app)

manager = Manager(app)

@@ -210,16 +210,31 @@
 rt Flask
+, make_response
 %0Afrom fl
@@ -392,16 +392,46 @@
 assword%0A
+from flask.ext import restful%0A
 from fla
@@ -607,16 +607,51 @@
 e_models
+%0Afrom flask.ext.restplus import Api
 %0A%0Aapp = 
@@ -988,16 +988,150 @@
 astore)%0A
+api = Api(app)%0Aapi.model(taxis_models.ADS, taxis_models.ADS.marshall_obj())%0Ans = api.namespace('ADS', description=%22Description ADS%22)%0A%0A
 from vie
@@ -1358,16 +1358,190 @@
 e.mod)%0A%0A
+@api.representation('text/html')%0Adef output_html(data, code=200, headers=None):%0A    resp = make_response(data, code)%0A    resp.headers.extend(headers or %7B%7D)%0A    return resp%0A%0A%0A
 @app.log
@@ -1670,96 +1670,32 @@
 auth
-:%0A        return None%0A    auth_splitted = auth.split(':')%0A    if len(auth_splitted
+ or auth.count(':'
 ) != 
-2
+1
 :%0A  
@@ -1742,17 +1742,19 @@
 auth
-_
+.
 split
-ted
+(':')
 %0A   
@@ -1992,18 +1992,16 @@
 user%0A%0A%0A%0A
-%0A%0A
 Bootstra

Use flask restplus