I have a local file default.xlsx.
I send it to https://v2.convertapi.com.
I take the content from the response and I try to save it in a default.pdf.
I have no error message.
When I try to open the created PDF, it looks corrupted.
import requests
import base64
f = open("default.xlsx", "rb").read()
f = base64.b64encode(f)
headers = {'Content-Type': 'application/json'}
payload = {
"Parameters": [
{
"Name": "File",
"FileValue": {
"Name": "default.xlsx",
"Data": f
}
},
]
}
r = requests.post('https://v2.convertapi.com/convert/xlsx/to/pdf?secret=SECRET-KEY', headers=headers, json=payload)
open('default.pdf', 'wb').write(r.content)

convertapi has a python module for doing this instead of trying to use the .json syntax. An example of this can be found here