CURL works but not translation into Python

Viewed 43

The following CURL code works perfectly from the cmd:

curl -X POST -H "Authorization: Bearer MY_KEY" ^
-H "Content-Type: multipart/form-data;" ^
-F "center=40.430,-3.702" ^
-F "propertyType=homes" ^
-F "distance=15000" ^
-F "operation=sale" ^
"https://api.idealista.com/3.5/es/search"

, but if I translate it into Python code using https://curl.trillworks.com/, like this:

import requests

headers = {
    'Authorization': 'Bearer MY_KEY',
    'Content-Type': 'multipart/form-data;',
}

files = {
    'center': (None, '40.430,-3.702'),
    'propertyType': (None, 'homes'),
    'distance': (None, '15000'),
    'operation': (None, 'sale'),
}

response = requests.post('https://api.idealista.com/3.5/es/search', headers=headers, files=files)

, well, then it does not work anymore, gives Error 500. What seems to be the problem?

0 Answers
Related