繁体   English   中英

当我使用requests.post发布文件时,它不起作用

[英]It didn't work when I post a file with requests.post

这是我的代码:

params = {
    "zipFile":"123456.zip",
    "projectName" : "test"
    }

dispatch = r.post("http://biqatest.baidu.com/dispatch/project/upload",files = params)

如您所见,这是一个发帖请求。

但响应是:

405
>Request method 'GET' not supported

真奇怪,为什么?

file = {'file': open('yourzipfile.zip', 'rb')}
data = {'projectName': 'test'}
dispatch = r.post("http://biqatest.baidu.com/dispatch/project/upload",files=file, data=data)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM