1
Guys I made this request in Python but not enough data in API, made in Postman works perfectly.
API_URL = "https://api-us.faceplusplus.com/facepp/v3/detect"
api_key = "7Z...uC"
api_secret = "lh...Sg"
image_url = "http://pushsistemas.com.br/id2.jpg"
headers = {
'content-type': "multipart/form-data"
}
data = {
"api_key":api_key,
"api_secret":api_secret,
"image_url":image_url
}
request_url = API_URL
face_response = requests.post(
request_url,
data = data,
headers=headers
)
face_response = face_response.json()
print(face_response)
Postman
import requests
url = "https://api-us.faceplusplus.com/facepp/v3/detect"
payload = "------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"api_key\"\r\n\r\n7Z...uC\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"api_secret\"\r\n\r\nl...Sg\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"image_url\"\r\n\r\nhttp://pushsistemas.com.br/id2.jpg\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW--"
headers = {
'content-type': "multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW",
'cache-control': "no-cache",
'Postman-Token': "0c381b9f-58c7-47da-91a8-c98670c0e2f9"
}
response = requests.request("POST", url, data=payload, headers=headers)
print(response.text)
And what happens? Error? Something?
– Renan Gomes
yes tell that the parameters did not arrive in the API.
– Adilmar Coelho Dantas
I updated the code the return of the api is that the parameters are missing
– Adilmar Coelho Dantas
Why there is
"multipart/form-data"
indata
? It wouldn’t just be"api_key": api_key
?– Woss
Yes, but it doesn’t work that way
– Adilmar Coelho Dantas
If yes, then take it out. Export the Postman request that worked and post in the question.
– Woss
I put the Postman output
– Adilmar Coelho Dantas