api.py 文件源码

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

项目:iris 作者: linkedin 项目源码 文件源码
def on_get(self, req, resp):
        '''
        Healthcheck endpoint. Returns contents of healthcheck file.

        **Example request**:

        .. sourcecode:: http

           GET /v0/healthcheck HTTP/1.1

        **Example response**:

        .. sourcecode:: http

           HTTP/1.1 200 OK
           Content-Type: text/plain

           GOOD
        '''
        try:
            with open(self.healthcheck_path) as f:
                health = f.readline().strip()
        except:
            raise HTTPNotFound()
        resp.status = HTTP_200
        resp.content_type = 'text/plain'
        resp.body = health
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号