THttpClient.py 文件源码

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

项目:download-manager 作者: thispc 项目源码 文件源码
def flush(self):
    if self.isOpen():
      self.close()
    self.open();

    # Pull data out of buffer
    data = self.__wbuf.getvalue()
    self.__wbuf = StringIO()

    # HTTP request
    self.__http.putrequest('POST', self.path)

    # Write headers
    self.__http.putheader('Host', self.host)
    self.__http.putheader('Content-Type', 'application/x-thrift')
    self.__http.putheader('Content-Length', str(len(data)))
    self.__http.endheaders()

    # Write payload
    self.__http.send(data)

    # Get reply to flush the request
    self.code, self.message, self.headers = self.__http.getreply()

  # Decorate if we know how to timeout
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号