📜  通过 Python 请求库通过 POST 发送数组 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:09.442000             🧑  作者: Mango

代码示例1
import requests
url= "path/to/api"
# Final Payload -> payload = {'key1': 'value1', 'key2': 'value2', 'keys[0]': 's1', 'keys[1]': 's2', 'keys[2]': 's3', 'keys[3]': 's4', 'keys[4]': 's5'}
keys=['s1','s2','s3','s4','s5']
data={'key1': 'value1', 'key2': 'value2', 'keys[]': keys}
r = requests.post(url, data)
res = r.json()
print(res)