python3 中post处理json 数据

使用详情如下

import json 
import requests

headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36"
}

data = json.dumps({"id": 4, "method": "test", "params": ["11111"]})
url = "http://www.xxx.com"
response = resquests.post(url = url,data=data,headers=headers)

posted @ 2019-12-04 17:12  g7y12  阅读(1544)  评论(0编辑  收藏  举报