Secure Share | Python SDK
Initializes a new Pangea service client.
Share(token, config, logger_name)Buckets
Share.buckets()Get information on the accessible buckets.
response = share.buckets()
Delete
Share.delete(id, force, bucket_id)Delete object by ID or path. If both are supplied, the path must match that of the object represented by the ID.
response = share.delete(id="pos_3djfmzg2db4c6donarecbyv5begtj2bm")
download-file
Share.download_file()Create a folder
Share.folder_create(name, metadata, parent_id, folder, tags, bucket_id)Create a folder, either by name or path and parent_id.
response = share.folder_create(
metadata={
"created_by": "jim",
"priority": "medium",
},
parent_id="pos_3djfmzg2db4c6donarecbyv5begtj2bm",
folder="/",
tags=["irs_2023", "personal"],
)
Get an object
Share.get(id, transfer_method, bucket_id, password)Get object. If both ID and Path are supplied, the call will fail if the target object doesn't match both properties.
response = share.get(
id="pos_3djfmzg2db4c6donarecbyv5begtj2bm",
folder="/",
)
Get archive
Share.get_archive(ids, format, transfer_method, bucket_id)Get an archive file of multiple objects.
response = share.get_archive(
ids=["pos_3djfmzg2db4c6donarecbyv5begtj2bm"],
)
List
Share.list(filter, last, order, order_by, size, bucket_id)List or filter/search records.
response = share.list()
Poll result
Share.poll_result(exception)Returns request's result that has been accepted by the server
response = service.poll_result(exception)
Upload a file
Share.put(file, name, folder, format, metadata, mimetype, parent_id, tags, transfer_method, crc32c, md5, sha1, sha256, sha512, size, bucket_id, password, password_algorithm)Upload a file.
try:
with open("./path/to/file.pdf", "rb") as f:
response = share.put(file=f)
print(f"Response: {response.result}")
except pe.PangeaAPIException as e:
print(f"Request Error: {e.response.summary}")
for err in e.errors:
print(f"\t{err.detail} \n")
Request upload URL
Share.request_upload_url(name, folder, format, metadata, mimetype, parent_id, tags, transfer_method, md5, sha1, sha512, crc32c, sha256, size, bucket_id)Request an upload URL.
response = share.request_upload_url(
transfer_method=TransferMethod.POST_URL,
crc32c="515f7c32",
sha256="c0b56b1a154697f79d27d57a3a2aad4c93849aa2239cd23048fc6f45726271cc",
size=222089,
metadata={
"created_by": "jim",
"priority": "medium",
},
parent_id="pos_3djfmzg2db4c6donarecbyv5begtj2bm",
folder="/",
tags=["irs_2023", "personal"],
)
Create share links
Share.share_link_create(links, bucket_id)Create a share link.
response = share.share_link_create(
links=[
{
targets: ["pos_3djfmzg2db4c6donarecbyv5begtj2bm"],
link_type: LinkType.DOWNLOAD,
authenticators: [
{
"auth_type": AuthenticatorType.PASSWORD,
"auth_context": "my_fav_Pa55word",
}
],
}
],
)
Delete share links
Share.share_link_delete(ids, bucket_id)Delete share links.
response = share.share_link_delete(
ids=["psl_3djfmzg2db4c6donarecbyv5begtj2bm"]
)
Get share link
Share.share_link_get(id)Get a share link.
response = share.share_link_get(
id="psl_3djfmzg2db4c6donarecbyv5begtj2bm"
)
List share links
Share.share_link_list(filter, last, order, order_by, size, bucket_id)Look up share links by filter options.
response = share.share_link_list()
Send share links
Share.share_link_send(sender_email)Send a secure share-link notification to a set of email addresses. The notification email will contain an Open button that the recipient can use to follow the secured share-link to authenticate and then access the shared content.
response = share.share_link_send(
links=[ShareLinkSendItem(id=link.id, email="foo@example.org")],
sender_email="sender@example.org",
)
Update a file
Share.update(id, path, add_metadata, remove_metadata, metadata, add_tags, remove_tags, tags, parent_id, updated_at, bucket_id)Update a file.
response = share.update(
id="pos_3djfmzg2db4c6donarecbyv5begtj2bm",
remove_metadata={
"created_by": "jim",
"priority": "medium",
},
remove_tags=["irs_2023", "personal"],
)