diff --git a/Python/Endpoint Examples/JSON Payload/html.py b/Python/Endpoint Examples/JSON Payload/html.py deleted file mode 100644 index 9e4f142..0000000 --- a/Python/Endpoint Examples/JSON Payload/html.py +++ /dev/null @@ -1,23 +0,0 @@ -import requests -import json - - -data = { - 'content': 'Web PageHello World!', - 'output': 'example_html_out' -} -print("Processing...") -response = requests.post(url='https://api.pdfrest.com/html', - data=json.dumps(data), - headers={'Content-Type': 'application/json', "API-Key": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"}) - -print("HTML response status code: " + str(response.status_code)) - -if response.ok: - response_json = response.json() - print(json.dumps(response_json, indent = 2)) - - - -else: - print(response.text) diff --git a/Python/Endpoint Examples/JSON Payload/pdf-info.py b/Python/Endpoint Examples/JSON Payload/pdf-info.py index 74d92b8..8758146 100644 --- a/Python/Endpoint Examples/JSON Payload/pdf-info.py +++ b/Python/Endpoint Examples/JSON Payload/pdf-info.py @@ -18,7 +18,7 @@ uploaded_id = upload_response_json['files'][0]['id'] info_data = { "id" : uploaded_id, "queries": "title" } - print(json.dumps(info_data, indent = 2))Content-Filename + print(json.dumps(info_data, indent = 2)) print("Processing file...") diff --git a/Python/Endpoint Examples/JSON Payload/pdf-with-imported-form-data.py b/Python/Endpoint Examples/JSON Payload/pdf-with-imported-form-data.py index 8fcd012..f737f6f 100644 --- a/Python/Endpoint Examples/JSON Payload/pdf-with-imported-form-data.py +++ b/Python/Endpoint Examples/JSON Payload/pdf-with-imported-form-data.py @@ -32,12 +32,12 @@ uploaded_pdf_id = upload_pdf_response_json['files'][0]['id'] uploaded_data_id = upload_data_response_json['files'][0]['id'] - added_image_data = { "id" : uploaded_pdf_id, "data_id": uploaded_data_id } + added_image_data = { "id" : uploaded_pdf_id, "data__file_id": uploaded_data_id } print(json.dumps(added_image_data, indent = 2)) print("Processing file...") - added_image_response = requests.post(url='https://api.pdfrest.com/pdf-with-added-image', + added_image_response = requests.post(url='https://api.pdfrest.com/pdf-with-imported-form-data', data=json.dumps(added_image_data), headers={'Content-Type': 'application/json', "API-Key": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"}) diff --git a/Python/Endpoint Examples/JSON Payload/zip.py b/Python/Endpoint Examples/JSON Payload/zip.py index 2c83250..a6cc10b 100644 --- a/Python/Endpoint Examples/JSON Payload/zip.py +++ b/Python/Endpoint Examples/JSON Payload/zip.py @@ -1,24 +1,24 @@ import requests import json -with open('/path/to/first_file', 'rb') as f: +with open('/path/to/first_file', 'rb') as f: # Note that the full file name plus extension needs to be reflected in 'Content-Filename below' upload_first_file_data = f.read() print("Uploading first file...") upload_first_file_response = requests.post(url='https://api.pdfrest.com/upload', data=upload_first_file_data, - headers={'Content-Type': 'application/octet-stream', 'Content-Filename': 'first_file.pdf', "API-Key": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"}) + headers={'Content-Type': 'application/octet-stream', 'Content-Filename': 'first_file', "API-Key": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"}) print("First upload response status code: " + str(upload_first_file_response.status_code)) -with open('/path/to/second_file', 'rb') as f: +with open('/path/to/second_file', 'rb') as f: # Note that the full file name plus extension needs to be reflected in 'Content-Filename below' upload_second_file_data = f.read() print("Uploading second file...") upload_second_file_response = requests.post(url='https://api.pdfrest.com/upload', data=upload_second_file_data, - headers={'Content-Type': 'application/octet-stream', 'content-filename': 'second_file.png', "API-Key": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"}) + headers={'Content-Type': 'application/octet-stream', 'content-filename': 'second_file', "API-Key": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"}) print("Second upload response status code: " + str(upload_second_file_response.status_code))