upyun.py 文件源码

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

项目:v2ex-tornado-2 作者: coderyy 项目源码 文件源码
def _net_worker(self, method, path, data='', headers={}, metadata={}):
        connection = httplib.HTTPConnection(self.thehost)

        if self.content_md5 != '':
            headers['Content-MD5'] = self.content_md5
            self.content_md5 = ''

        if self.file_secret != '':
            headers['Content-Secret'] = self.file_secret
            self.file_secret = ''

        final_headers = merge_meta(headers, metadata)

        if self.upAuth:
            self._add_upyun_auth_header(final_headers,method,path)
        else :
            self._basicAuth(final_headers,self.username,self.password) 

        connection.request(method, path , data, final_headers)

        resp = connection.getresponse()                                                                 
        if self.debug and resp.status != 200 and method != "HEAD" :
            raise UpYunException(u'ERROR: Code:%d,Message:%s'%(resp.status,resp.read()))
        return resp

    #??????
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号