Exemple #1
0
def get_app():
    global FARADAY_APP  # pylint: disable=W0603
    if not FARADAY_APP:
        app = create_app()  # creates a Flask(__name__) app
        # After 'Create app'
        FARADAY_APP = app
    return FARADAY_APP
Exemple #2
0
def get_app():
    global FARADAY_APP  # pylint: disable=W0603
    if not FARADAY_APP:
        app = create_app()  # creates a Flask(__name__) app
        # After 'Create app'
        app.config['MAIL_SERVER'] = smtp.host
        app.config['MAIL_PORT'] = smtp.port
        app.config['MAIL_USE_SSL'] = smtp.ssl
        app.config['MAIL_USERNAME'] = smtp.username
        app.config['MAIL_PASSWORD'] = smtp.password
        mail = Mail(app)
        FARADAY_APP = app
    return FARADAY_APP
Exemple #3
0
def app(request):
    app = create_app(db_connection_string=request.config.getoption(
        '--connection-string'), testing=True)
    app.test_client_class = CustomClient

    # Establish an application context before running the tests.
    ctx = app.app_context()
    ctx.push()

    def teardown():
        TEMPORATY_SQLITE.close()
        ctx.pop()

    request.addfinalizer(teardown)
    app.config['NPLUSONE_RAISE'] = not request.config.getoption(
        '--ignore-nplusone')
    return app
Exemple #4
0
from flask_mail import Mail

from OpenSSL.SSL import Error as SSLError

import faraday.server.config

from faraday.server.config import CONST_FARADAY_HOME_PATH, smtp
from faraday.server.utils import logger
from faraday.server.threads.reports_processor import ReportsManager, REPORTS_QUEUE
from faraday.server.threads.ping_home import PingHomeThread
from faraday.server.app import create_app
from faraday.server.websocket_factories import (WorkspaceServerFactory,
                                                BroadcastServerProtocol)

app = create_app()  # creates a Flask(__name__) app
# After 'Create app'
app.config['MAIL_SERVER'] = smtp.host
app.config['MAIL_PORT'] = smtp.port
app.config['MAIL_USE_SSL'] = smtp.ssl
app.config['MAIL_USERNAME'] = smtp.username
app.config['MAIL_PASSWORD'] = smtp.password
mail = Mail(app)
logger = logging.getLogger(__name__)


class CleanHttpHeadersResource(Resource):
    def render(self, request):
        request.responseHeaders.removeHeader('Server')
        return super(CleanHttpHeadersResource, self).render(request)