1. 安装requests
pip install requests
2. 代码:
import requests
url = "http://www.lance.cn/myweb/request"
headers = {'content-type': 'application/json'}
requestData = {"name": "lance", "age": "28"}
ret = requests.post(url, json=requestData, headers=headers)
if ret.status_code == 200:
text = json.loads(ret.text)
print(text)