Skip to content

Commit 89387dd

Browse files
Update getAttachmentAndSave.py
1 parent 3e2eef3 commit 89387dd

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Uses-Cases/Attachments/get/getAttachmentAndSave.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ class Config:
1313
CREDENTIALS_FILE = Path(r"C:\\Projects\\ASPOSE\\Pdf.Cloud\\Credentials\\credentials.json")
1414
LOCAL_FOLDER = Path(r"C:\Samples")
1515
PDF_DOCUMENT_NAME = "sample_file_with_attachment.pdf"
16-
LOCAL_RESULT_DOCUMENT_NAME = "output_sample.pdf"
17-
ATTACHMENT_PATH = "/1"
16+
ATTACHMENT_PATH = ""
1817

1918
class PdfAttachments:
2019
"""Class for managing PDF attachments using Aspose PDF Cloud API."""
@@ -62,6 +61,7 @@ def get_attachments(self):
6261
response : AttachmentsResponse = self.pdf_api.get_document_attachments(Config.PDF_DOCUMENT_NAME)
6362
if response.code == 200:
6463
logging.info(f"get_attachmnets(): attachments '{response.attachments}' for the document '{Config.PDF_DOCUMENT_NAME}'.")
64+
Config.ATTACHMENT_PATH = response.attachments.list[0].links[0].href;
6565
else:
6666
logging.error(f"get_attachmnets(): Failed to get attachments to the document. Response code: {response.code}")
6767
except Exception as e:
@@ -90,4 +90,4 @@ def get_attachment_by_id(self):
9090
pdf_attachments = PdfAttachments()
9191
pdf_attachments.upload_document()
9292
pdf_attachments.get_attachments()
93-
pdf_attachments.get_attachment_by_id()
93+
pdf_attachments.get_attachment_by_id()

0 commit comments

Comments
 (0)