Skip to content

Commit fe06ba4

Browse files
committed
Confluence: add example of downloading attachments
1 parent db6f47e commit fe06ba4

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
from atlassian import Confluence
2+
import os
3+
4+
confluence_datacenter = Confluence(
5+
url='confl_server_url',
6+
token='<api_token>'
7+
)
8+
9+
10+
def download_attachments_test(api_wrapper_object, page_id, directory_path):
11+
api_wrapper_object.download_attachments_from_page(page_id=page_id, path=directory_path)
12+
13+
14+
def check_file_size(directory):
15+
for filename in os.listdir(directory):
16+
if os.path.isfile(os.path.join(directory, filename)):
17+
print(f'File: {filename}, Size: {os.path.getsize(os.path.join(directory, filename))} bytes')
18+
19+
20+
download_attachments_test(confluence_datacenter, 393464, '~/Downloads/confluence_attachments')
21+
check_file_size('~/Downloads/confluence_attachments')

0 commit comments

Comments
 (0)