1

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

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

additionally import json and data = json.dumps(vector)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.