http 协议中 有四种 POST 提交数据方式 https://imququ.com/post/four-ways-to-post-data-in-http.html
当 curl 请求时 使用 --data 是无法将数据传递到body 体中的
POST http://www.example.com HTTP/1.1 Content-Type:multipart/form-data; boundary=----WebKitFormBoundaryrGKCBY7qhFd3TrwA ------WebKitFormBoundaryrGKCBY7qhFd3TrwA Content-Disposition: form-data; name="text" title ------WebKitFormBoundaryrGKCBY7qhFd3TrwA Content-Disposition: form-data; name="file"; filename="chrome.png" Content-Type: image/png PNG ... content of chrome.png ... ------WebKitFormBoundaryrGKCBY7qhFd3TrwA--
#!/bin/python2 # coding=utf8 import requests import json data='[{"UserName":"huyidao","Password":"123456789"]' result = requests.post('http://192.168.1.2/pythonpost8',data=dict({"data":data})) print result.text