websocketclient.py 文件源码

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

项目:AmericanFootballScoreboard 作者: chris109b 项目源码 文件源码
def _fetch_initial_data(self):
        data = None
        headers = httputil.HTTPHeaders({'Content-Type': Core.DATA_MIME_TYPE})
        http_client = httpclient.HTTPClient()
        try:
            response = http_client.fetch(self.__initial_data_url, headers=headers)
            data = response.body
        except httpclient.HTTPError as e:
            # HTTPError is raised for non-200 responses; the response
            # can be found in e.response.
            print("Error: " + str(e))
        except Exception as e:
            # Other errors are possible, such as IOError.
            print("Error: " + str(e))
        finally:
            http_client.close()
        return data.decode(Core.ENCODING)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号