nodeinfo.py 文件源码

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

项目:treadmill 作者: Morgan-Stanley 项目源码 文件源码
def init(api, _cors, impl):
    """Configures REST handlers for allocation resource."""

    namespace = webutils.namespace(
        api, __name__, 'Local nodeinfo redirect API.'
    )

    @namespace.route('/<hostname>/<path:path>')
    class _NodeRedirect(restplus.Resource):
        """Redirects to local nodeinfo endpoint."""

        def get(self, hostname, path):
            """Returns list of local instances."""
            hostport = impl.get(hostname)
            if not hostport:
                return 'Host not found.', http_client.NOT_FOUND

            url = utils.encode_uri_parts(path)
            return flask.redirect('http://%s/%s' % (hostport, url),
                                  code=http_client.FOUND)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号