python用金山快盘API进行上传老返回405
def _upload(self):
baseurl=self._upload_url_get()+'1/fileops/upload_file'
baseurl=(baseurl)
print 'baseurl =',type(baseurl)
parameters=self._parameters()
parameters['overwrite']='True'
parameters['root']='kuaipan'
parameters['path']='%2Ftea.txt'
url = self._generate_url(baseurl,parameters,'POST')
print "!!!!!!!!!!!!!!!!!))))) :",type(url)
url+= "&file="
url+= "tea.txt"
print 'url : ',url
rf = urllib.urlopen(url)
status = rf.getcode()
print 'status :',status
生成的url类似:url :
http://p5.dfs.kuaipan.cn:8080/cdlnode/1/fileops/upload_file?oauth_nonce=IvNTx3CsW7&oauth_timestamp=1395924148&oauth_consumer_key=xcLlpfLXmKKekGFI&oauth_signature_method=HMAC-SHA1&oauth_version=1.0&oauth_token=018cc13034d1f8a408c08109&path=%252Ftea.txt&root=kuaipan&overwrite=True&oauth_signature=CT09YvTqUPY36LYRTiI1kYAn7nI%3D&file=tea.txt
status : 405
按照官网(
http://www.kuaipan.cn/developers/document_apiupload.htm
)上给的参数应该是没问题的,但是总是返回405。 小弟python新手,希望大家能帮忙一下。
谢谢。
SoLA.
11 years, 3 months ago