How can I sent POST request in Python? Request must be multipart/mixed with json and photo without header. I try send this request with requests in python, but this package adds a description to the Data and the requests breaks the json into several parts. Example of a correct request's structure on photo. It is my code:
photo = open("photo.jpg", "rb")
file = {
"Data": photo
}
new_card = {
"AlternateId": "4558021a-4c29-5360-a511-08c59b52265c",
"CreatedBy": "1",
"Information": "test",
"IsActive": True,
"IsDeleted": False,
"UserGroupId": 3,
"PersonCardCategoryId": 3
}
r = requests.post("http://172.16.127.160:34015", auth=("1", "1"), data=new_card, files=file)
Updates:
Code:
r = requests.post("http://172.16.127.160:34015", auth=("1", "1"), json=new_card, files=file)
Now, WireShark shows me it