def create_app(self): logging.getLogger('connexion.operation').setLevel('ERROR') app = connexion.App(__name__, specification_dir='../openapi/') app.app.json_encoder = JSONEncoder app.add_api('openapi.yaml', pythonic_params=True) AuditLog(app) CacheControl(app) cache.init_app(app.app) return app.app
def main(): app = get_app() app.run(port=8080) logging.basicConfig(level=logging.INFO) AuditLog(app) CacheControl(app) if 'GAE_INSTANCE' in os.environ: SSLify(app, permanent=True)
def main(): app = connexion.App(__name__, specification_dir='./openapi/') app.app.json_encoder = encoder.JSONEncoder app.add_api('openapi.yaml', arguments={'title': 'Expenses API'}, pythonic_params=True) app.run(port=8080) logging.basicConfig(level=logging.INFO) AuditLog(app) CacheControl(app) if 'GAE_INSTANCE' in os.environ: SSLify(app, permanent=True)
def __init__(self): self.cxnapp = connexion.App(__name__, specification_dir="openapi/") self.cxnapp.add_api( "openapi.yaml", strict_validation=True, validator_map={"body": RequestBodyValidator}, ) AuditLog(self.cxnapp) CORS(self.cxnapp.app) with self.cxnapp.app.app_context(): current_app.__pii_filter_def__ = None current_app.schemas = None current_app.paths = None current_app.base_path = config.BASE_PATH current_app.cloudstorage = [] current_app.cloudlogstorage = [] if hasattr(config, "API_KEY_SECRET_CONVERSION"): current_app.config["JSON_SORT_KEYS"] = False compression = (config.COMPRESSION if hasattr( config, "COMPRESSION") else False) if hasattr(config, "AZURE_STORAGE_ACCOUNT"): current_app.cloudstorage.append( AzureCloudStorage( config.AZURE_STORAGE_ACCOUNT, config.AZURE_STORAGE_KEY, config.AZURE_STORAGE_CONTAINER, )) if hasattr(config, "GOOGLE_STORAGE_BUCKET"): current_app.cloudstorage.append( GoogleCloudStorage(config.GOOGLE_STORAGE_BUCKET, compression)) if hasattr(config, "GOOGLE_LOG_BUCKET"): current_app.cloudlogstorage.append( GoogleCloudStorage(config.GOOGLE_LOG_BUCKET, compression))
import logging import os import config import connexion from Flask_AuditLog import AuditLog from Flask_No_Cache import CacheControl from flask_cors import CORS from flask_sslify import SSLify app = connexion.App(__name__, specification_dir='./openapi_server/openapi/') app.add_api('openapi.yaml', arguments={'title': 'nssurveyapi'}, pythonic_params=True) if 'GAE_INSTANCE' in os.environ: CORS(app.app, origins=config.ORIGINS) else: CORS(app.app) logging.basicConfig(level=logging.INFO) AuditLog(app) CacheControl(app) if 'GAE_INSTANCE' in os.environ: SSLify(app.app, permanent=True) if __name__ == '__main__': app.run(host='127.0.0.1', port=8080)