bitcoinrpc.py 文件源码

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

项目:ClockBlocker 作者: pinheadmz 项目源码 文件源码
def _request(self, method, path, postdata):
        '''
        Do a HTTP request, with retry if we get disconnected (e.g. due to a timeout).
        This is a workaround for https://bugs.python.org/issue3566 which is fixed in Python 3.5.
        '''
        headers = {'Host': self.__url.hostname,
                   'User-Agent': USER_AGENT,
                   'Authorization': self.__auth_header,
                   'Content-type': 'application/json'}
        try:
            self.__conn.request(method, path, postdata, headers)
            return self._get_response()
        except httplib.BadStatusLine as e:
            if e.line == "''": # if connection was closed, try again
                self.__conn.close()
                self.__conn.request(method, path, postdata, headers)
                return self._get_response()
            else:
                raise
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号