May-06-2020, 08:45 AM
Hi,
I am not sure what I have missed, but I can't get this Curl command to work with the code below. What am I missing? I am getting a 400 returned.
The Curl is
curl -X POST "URL" -H "Authorization: token" \
-H "X-Correlation-ID: Optional" \
-F "file=@/Users/Shared/Reports/file.exe" \
-F "report_format=html"
My code is
I am not sure what I have missed, but I can't get this Curl command to work with the code below. What am I missing? I am getting a 400 returned.
The Curl is
curl -X POST "URL" -H "Authorization: token" \
-H "X-Correlation-ID: Optional" \
-F "file=@/Users/Shared/Reports/file.exe" \
-F "report_format=html"
My code is
access_token = authenticate(client_id, client_secret) query_url = 'URL' headers = {'Authorization': access_token # 'Accept': 'application/json SUCCESS', # 'Content-Type': 'multipart/form-data' } files = { 'file': '@/Users/Shared/Reports/file.exe', 'report_format': 'html' } # This is optional # headers['X-Correlation-ID'] = 'optional' request_result = requests.post( query_url, headers=headers, files=files ) result = request_result.json() return