server.py 文件源码

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

项目:farfetchd 作者: isislovecruft 项目源码 文件源码
def render_GET(self, request):
        request.responseHeaders.setRawHeaders(b"Content-Type", ["text/html"])

        data = bytes()
        path = []

        path.append(os.path.dirname(__file__))

        # If we're being run from the build/ directory of a source or git tree,
        # append the full path:
        if not os.path.isabs(path[0]):
            path.insert(0, os.getcwd())
        # If we're being run as part of some unittests, get rid of the test dir:
        if path[0].endswith("_trial_temp"):
            path[0] = path[0].rsplit("_trial_temp")[0]

        path.append('API.html')
        spec = os.path.sep.join(path)

        with open(spec) as fh:
            data += bytes(fh.read())

        return data
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号