diff --git a/firefly/app.py b/firefly/app.py index 128f5c8..89d2de5 100644 --- a/firefly/app.py +++ b/firefly/app.py @@ -9,6 +9,7 @@ from .version import __version__ import threading from wsgiref.simple_server import make_server +from flask import Flask try: from inspect import signature, _empty @@ -25,7 +26,7 @@ ctx.request = None class Firefly(object): - def __init__(self, auth_token=None, allowed_origins=""): + def __init__(self, name="firefly", auth_token=None, allowed_origins="", flask_app=None): """Creates a firefly application. If the optional parameter auth_token is specified, the @@ -39,11 +40,12 @@ def __init__(self, auth_token=None, allowed_origins=""): :param auth_token: the auto_token for the application :param allowed_origins: allowed origins for cross-origin requests """ + self.name = name self.mapping = {} self.add_route('/', self.generate_index,internal=True) self.auth_token = auth_token self.allowed_origins = allowed_origins - + self.flask_app = flask_app or Flask(name) def set_auth_token(self, token): self.auth_token = token diff --git a/requirements.txt b/requirements.txt index e3f9fe7..f4f2c40 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,3 +3,4 @@ WebOb>=1.7.2 requests>=2.18.1 PyYAML>=3.12 funcsigs>=1.0.2 ; python_version < '3' +Flask==1.0.2