maikelm
maikelm

Reputation: 403

pass array of array in request post in python

I am used request in python. I try to sent a post request and need send array of array. This is my code:

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]])

the server return: error 500. I tested using POSTMAN and the server return a correct result

Upvotes: 1

Views: 5375

Answers (1)

olofom
olofom

Reputation: 6491

You're using post and are most likely interested in using data instead or params. It should be a dictionary structure instead of a list though. See the docs.

Upvotes: 1

Related Questions