Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
- The /html route does not actually exist in production
- Extra words got copied/moved into the pdf-info sample
- Corrected imported data to call the right route
- Clarify naming for zip since it can take literally anything
  • Loading branch information
datalogics-tsmith committed Oct 31, 2023
1 parent 176a6d7 commit e85945a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 30 deletions.
23 changes: 0 additions & 23 deletions Python/Endpoint Examples/JSON Payload/html.py

This file was deleted.

2 changes: 1 addition & 1 deletion Python/Endpoint Examples/JSON Payload/pdf-info.py
Original file line number Diff line number Diff line change
Expand Up @@ -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...")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"})

Expand Down
8 changes: 4 additions & 4 deletions Python/Endpoint Examples/JSON Payload/zip.py
Original file line number Diff line number Diff line change
@@ -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))

Expand Down

0 comments on commit e85945a

Please sign in to comment.