import requests
import json
url = 'https://www.vivo.com/store/shops'
headers = {
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36'
}
From_data = {
"province": "山东省",
"city": "济南市",
"searchType": "0",
"latitude": "36.66199",
"longitude": "117.51855",
"minRadius": "30",
"from": "1"
}
response = requests.post(url=url, headers=headers, data=From_data)
str_json = json.loads(response.text)
print(json.dumps(str_json, sort_keys=True, indent=4, separators=(',', ':'), ensure_ascii=False))
Post Json格式数据:
import requests
url = 'https://demo.xxx.com/Sacrifice/insertSacrifice'
data = {
"sacrificeFlower": "2",
"sacrificeVenue": "济南解放纪念馆",
"sacrificeTitle": "2021庆崛起",
"sacrificeName": "xxx",
"sacrificeValues": "缅怀先烈,向革命烈士致敬,勿忘国耻。"
}
r = requests.post(url=url, json=data)
print(r.text)