python中请求post中数组的传递

2024-10-01 09:38:13 发布

您现在位置:Python中文网/ 问答频道 /正文

我用python请求。我试图发送一个post请求,需要发送数组的数组。这是我的代码:

import requests

def connecttomlapipost(url, vector):
   headers = {'content-type': 'application/json'}
   r= requests.post(url, verify=False, auth=('admin', 'admin'), data = vector, headers=headers)
   return r

print connecttomlapipost('https://......', [[2,3],[1,5]])

服务器返回:错误500。我使用POSTMAN测试,服务器返回正确的结果


Tags: 代码importurladminapplicationdeftype数组