Example #1
0
            pass
        return super(Api, self).response(code_or_apierror, description, model=model)


class APIResource(Resource):
    """All api resources should subclass this class."""

    method_decorators = [with_session]

    def __init__(self, api, *args, **kwargs):
        self.manager = manager.manager
        super(APIResource, self).__init__(api, *args, **kwargs)


app = Flask(__name__, template_folder=os.path.join(os.path.dirname(__path__[0]), "templates"))
app.config["REMEMBER_COOKIE_NAME"] = "flexgetToken"
app.config["DEBUG"] = True

CORS(app)
Compress(app)

api = Api(
    app,
    catch_all_404s=True,
    title="API",
    version=__version__,
    description='<font color="red"><b>Warning: under development, subject to change without notice.<b/></font>',
)


class ApiError(Exception):
Example #2
0
# -*- coding: utf-8 -*-

import random
import string
import datetime

from flask import Flask, session, request, abort
from flask.ext.login import LoginManager

import config

app = Flask(__name__)
app.config["DEBUG"] = config.get("debug", bool)
app.config["SECRET_KEY"] = config.get("secret_key")
app.config["REMEMBER_COOKIE_NAME"] = config.get("remember_cookie_name")
app.config["REMEMBER_COOKIE_DURATION"] = datetime.timedelta(days=config.get("remember_cookie_duration", int))


import urls
import user
import messages

# Flask-Extension: Login
loginmanager = LoginManager()
loginmanager.setup_app(app)
loginmanager.login_view = "login"
loginmanager.login_message = messages.login_required
loginmanager.session_protection = "strong"


@loginmanager.user_loader