api.py 文件源码

python
阅读 37 收藏 0 点赞 0 评论 0

项目:openbrokerapi 作者: eruvanos 项目源码 文件源码
def serve(services: List[Service],
          credentials: BrokerCredentials,
          logger: logging.Logger = logging.root,
          port=5000,
          debug=False):
    """
    Starts flask with the given broker

    :param services: Services that this broker provides
    :param credentials: Username and password that will be required to communicate with service broker
    :param logger: Used for api logs. This will not influence Flasks logging behavior
    :param port: Port
    :param debug: Enables debugging in flask app
    """

    from flask import Flask
    app = Flask(__name__)

    blueprint = get_blueprint(services, credentials, logger)

    logger.debug("Register openbrokerapi blueprint")
    app.register_blueprint(blueprint)

    logger.info("Start Flask on 0.0.0.0:%s" % port)
    app.run('0.0.0.0', port, debug)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号