Esempio n. 1
0
    return headers


def get_user_key(service, user):
    key = user.keys.filter_by(service_alias=service.alias).first()
    if not key:
        abort(403)
    if key.is_expired():
        # Key has expired
        if key.refresh_token:
            data = service.refresh_token(key.refresh_token)
            key.update(data)
            models.db.session.add(key)
            models.db.session.commit()
        else:
            # Unable to refresh the token
            abort(403)
    return key


blog = static.Cling('blog/output')
app = DispatcherMiddleware(config.app, {
    '/blog': blog,
})


if __name__ == '__main__':
    port = int(os.environ.get("PORT", 5000))
    app.run(host='0.0.0.0', port=port)
Esempio n. 2
0
File: wsgi.py Progetto: soosap/nlp
from werkzeug.wsgi import DispatcherMiddleware

from nlp import abstract, sentiment, welcome

application = DispatcherMiddleware(welcome.create_app(), {
    '/abstract': abstract.create_app(),
    '/sentiment': sentiment.create_app(),
})

if __name__ == "__main__":
    application.run()
Esempio n. 3
0
from werkzeug.wsgi import DispatcherMiddleware

from app import app as app_homepage
import fantasydrafts
import fantasypl

from flask import render_template
from flask_sslify import SSLify

sslify_fantasydrafts = SSLify(fantasydrafts.app)
sslify_fantasypl = SSLify(fantasypl.app)
sslify_homepage = SSLify(app_homepage)

app = DispatcherMiddleware(app_homepage, {'/drafts': fantasydrafts.app,
										  '/fantasypl': fantasypl.app})

@app_homepage.route('/')
def index():
	return render_template('index.html',
						   url_draft = '/drafts/necessary-roughness-2014/',
						   url_fantasypl = '/fantasypl/')

if __name__ == '__main__':
	app.run()
Esempio n. 4
0
        del headers['Content-Type']

    return headers


def get_user_key(service, user):
    key = user.keys.filter_by(service_alias=service.alias).first()
    if not key:
        abort(403)
    if key.is_expired():
        # Key has expired
        if key.refresh_token:
            data = service.refresh_token(key.refresh_token)
            key.update(data)
            models.db.session.add(key)
            models.db.session.commit()
        else:
            # Unable to refresh the token
            abort(403)
    return key


blog = static.Cling('blog/output')
app = DispatcherMiddleware(config.app, {
    '/blog': blog,
})

if __name__ == '__main__':
    port = int(os.environ.get("PORT", 5000))
    app.run(host='0.0.0.0', port=port)