简体   繁体   English

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

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

this is my code: 这是我的代码:

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

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

As you can see,it's a post request. 如您所见,这是一个发帖请求。

but the reponse is: 但响应是:

405
>Request method 'GET' not supported

It's so strange,why? 真奇怪,为什么?

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