Quantcast
Channel: Active questions tagged rest - Stack Overflow
Viewing all articles
Browse latest Browse all 3619

Error 415 when trying to merge PDFs by stirlingpdf.io with python

$
0
0

I am trying to merge two PDF files through the API of StirlingPDF with Python.Unfortunately, I always get an Error 415 back from the request (see below).

filepaths = [r"C:\Users\Public\Documents\data1.pdf",             r"C:\Users\Public\Documents\data2.pdf"]binary_data=[]for filepath in filepaths:    # read files in binary    with open(filepath, 'rb') as file:        binary_data.append(file.read())url = "https://stirlingpdf.io/api/v1/general/merge-pdfs"req_data ={"fileInput": binary_data, "sortType": "orderProvided", "removeCertSign": False}# send a POST-request to APIresponse = requests.post(url, data=req_data)

I already tried the easiest get methods (get uptime) and they worked.As the documentation tells (API) i try to put it as a binary file to the API.

It should also be executed by the web-API, because the same code structure will be used in Python and VBA.

26.11.2024: The status of the webrequest is 415 'Unsupported Media Type' with the message "Content-Type 'application/json' is not supported."


Viewing all articles
Browse latest Browse all 3619

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>