问题描述
- python使用httplib发送put请求可以带参数么?
-
This creates an HTTP message
with the content of BODY as the enclosed representation
for the resource http://localhost:8080/foobar
...
import httplib
BODY = "***filecontents***"
conn = httplib.HTTPConnection("localhost", 8080)
conn.request("PUT", "/file", BODY)
response = conn.getresponse()
print response.status, response.reason
200, OK这个是官方文档的例子,我看了下request的方法代码,参数还可以传个headers进去。就像这样:conn.request("PUT", "/file", body=BODY,headers={}),那我现在file后边还有参数的,我怎么加进去。就是这样的put host/file.txt?aaa=bbb&ccc=ddd
解决方案
直接放url中一起把参数带过去
解决方案二:
熊弟你这个排版我手机都看尿了
时间: 2024-10-29 07:08:13