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

查看全部
liuyo3472
liuyo3472
2015/06/25 13:48
  • python
  • 参数
  • 请求
  • put
  • 点赞
  • 收藏
  • 回答
    私信

2个回复