Skip to main content

Secure Share | Python SDK

init

Share()

Delete (Beta)

Share.delete(id, path, force)

Delete object by ID or path. If both are supplied, the path must match that of the object represented by the ID. How to install a Beta release.

optional parameters

str

The ID of the object to delete.

str

The path of the object to delete.

bool

If true, delete a folder even if it's not empty.

Response Object

A PangeaResponse. Available response fields can be found in our API documentation.

response = share.delete(id="pos_3djfmzg2db4c6donarecbyv5begtj2bm")

download-file

Share.download_file()

Create a folder (Beta)

Share.folder_create(name, metadata, parent_id, path, tags)

Create a folder, either by name or path and parent_id. How to install a Beta release.

optional parameters

str

The name of an object.

Metadata

A set of string-based key/value pairs used to provide additional data about an object.

str

The ID of a stored object.

str

A case-sensitive path to an object. Contains a sequence of path segments delimited by the the / character. Any path ending in a / character refers to a folder.

Tags

A list of user-defined tags.

Response Object

A PangeaResponse. Available response fields can be found in our API documentation.

response = share.folder_create(
    metadata={
        "created_by": "jim",
        "priority": "medium",
    },
    parent_id="pos_3djfmzg2db4c6donarecbyv5begtj2bm",
    path="/",
    tags=["irs_2023", "personal"],
)

Get an object (Beta)

Share.get(id, path, transfer_method)

Get object. If both ID and Path are supplied, the call will fail if the target object doesn't match both properties. How to install a Beta release.

optional parameters

str

The ID of the object to retrieve.

str

The path of the object to retrieve.

TransferMethod

The requested transfer method for the file data.

Response Object

A PangeaResponse. Available response fields can be found in our API documentation.

response = share.get(
    id="pos_3djfmzg2db4c6donarecbyv5begtj2bm",
    path="/",
)

Get archive (Beta)

Share.get_archive(ids, format, transfer_method)

Get an archive file of multiple objects. How to install a Beta release.

required parameters

List[str]

The IDs of the objects to include in the archive. Folders include all children.

optional parameters

ArchiveFormat

The format to use for the built archive.

TransferMethod

The requested transfer method for the file data.

Response Object

A PangeaResponse. Available response fields can be found in our API documentation.

response = share.get_archive(
    ids=["pos_3djfmzg2db4c6donarecbyv5begtj2bm"],
)

List (Beta)

Share.list(filter, last, order, order_by, size)

List or filter/search records. How to install a Beta release.

optional parameters

Union[Dict[str, str], FilterList]
str

Reflected value from a previous response to obtain the next page of results.

ItemOrder

Order results asc(ending) or desc(ending).

ItemOrderBy

Which field to order results by.

int

Maximum results to include in the response.

Response Object

A PangeaResponse. Available response fields can be found in our API documentation.

response = share.list()

Poll result

Share.poll_result(exception)

Returns request's result that has been accepted by the server

required parameters

AcceptedRequestException

Exception raise by SDK on the call that is been processed.

Response Object

PangeaResponse

response = service.poll_result(exception)

Upload a file (Beta)

Share.put(file, name, path, format, metadata, mimetype, parent_id, tags, transfer_method, crc32c, md5, sha1, sha256, sha512, size)

Upload a file. How to install a Beta release.

required parameters

io.BufferedReader

optional parameters

str

The name of the object to store.

str

An optional path where the file should be placed. Will auto-create directories if necessary.

FileFormat

The format of the file, which will be verified by the server if provided. Uploads not matching the supplied format will be rejected.

Metadata

A set of string-based key/value pairs used to provide additional data about an object.

str

The MIME type of the file, which will be verified by the server if provided. Uploads not matching the supplied MIME type will be rejected.

str

The parent ID of the object (a folder). Leave blank to keep in the root folder.

Tags

A list of user-defined tags.

TransferMethod

The transfer method used to upload the file data.

str

The hexadecimal-encoded CRC32C hash of the file data, which will be verified by the server if provided.

str

The hexadecimal-encoded MD5 hash of the file data, which will be verified by the server if provided.

str

The hexadecimal-encoded SHA1 hash of the file data, which will be verified by the server if provided.

str

The SHA256 hash of the file data, which will be verified by the server if provided.

str

The hexadecimal-encoded SHA512 hash of the file data, which will be verified by the server if provided.

str

The size (in bytes) of the file. If the upload doesn't match, the call will fail.

Response Object

A PangeaResponse. Available response fields can be found in our API documentation.

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 (Beta)

Share.request_upload_url(name, path, format, metadata, mimetype, parent_id, tags, transfer_method, md5, sha1, sha512, crc32c, sha256, size)

Request an upload URL. How to install a Beta release.

optional parameters

str

The name of the object to store.

str

An optional path where the file should be placed. Will auto-create directories if necessary.

FileFormat

The format of the file, which will be verified by the server if provided. Uploads not matching the supplied format will be rejected.

Metadata

A set of string-based key/value pairs used to provide additional data about an object.

str

The MIME type of the file, which will be verified by the server if provided. Uploads not matching the supplied MIME type will be rejected.

str

The parent ID of the object (a folder). Leave blank to keep in the root folder.

Tags

A list of user-defined tags.

TransferMethod

The transfer method used to upload the file data.

str

The hexadecimal-encoded MD5 hash of the file data, which will be verified by the server if provided.

str

The hexadecimal-encoded SHA1 hash of the file data, which will be verified by the server if provided.

str

The hexadecimal-encoded SHA512 hash of the file data, which will be verified by the server if provided.

str

The hexadecimal-encoded CRC32C hash of the file data, which will be verified by the server if provided.

str

The SHA256 hash of the file data, which will be verified by the server if provided.

str

The size (in bytes) of the file. If the upload doesn't match, the call will fail.

Response Object

A PangeaResponse. Available response fields can be found in our API documentation.

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",
    path="/",
    tags=["irs_2023", "personal"],
)
Share.share_link_create(links)

Create a share link. How to install a Beta release.

response = share.share_link_create(
    links=[
        {
            targets: ["pos_3djfmzg2db4c6donarecbyv5begtj2bm"],
            link_type: LinkType.DOWNLOAD,
            authenticators: [
                {
                    "auth_type": AuthenticatorType.PASSWORD,
                    "auth_context": "my_fav_Pa55word",
                }
            ],
        }
    ],
)
Share.share_link_delete(ids)

Delete share links. How to install a Beta release.

response = share.share_link_delete(
    ids=["psl_3djfmzg2db4c6donarecbyv5begtj2bm"]
)
Share.share_link_get(id)

Get a share link. How to install a Beta release.

response = share.share_link_get(
    id="psl_3djfmzg2db4c6donarecbyv5begtj2bm"
)
Share.share_link_list(filter, last, order, order_by, size)

Look up share links by filter options. How to install a Beta release.

response = share.share_link_list()
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. How to install a Beta release.

response = share.share_link_send(
    links=[ShareLinkSendItem(id=link.id, email="foo@example.org")],
    sender_email="sender@example.org",
)

Update a file (Beta)

Share.update(id, path, add_metadata, remove_metadata, metadata, add_tags, remove_tags, tags, parent_id, updated_at)

Update a file. How to install a Beta release.

optional parameters

str

An identifier for the file to update.

str

An alternative to ID for providing the target file.

Metadata

A list of Metadata key/values to set in the object. If a provided key exists, the value will be replaced.

Metadata

A list of Metadata key/values to remove in the object. It is not an error for a provided key to not exist. If a provided key exists but doesn't match the provided value, it will not be removed.

Metadata

Set the object's Metadata.

Tags

A list of Tags to add. It is not an error to provide a tag which already exists.

Tags

A list of Tags to remove. It is not an error to provide a tag which is not present.

Tags

Set the object's Tags.

str

Set the parent (folder) of the object.

str

The date and time the object was last updated. If included, the update will fail if this doesn't match what's stored.

Response Object

A PangeaResponse. Available response fields can be found in our API documentation.

response = share.update(
    id="pos_3djfmzg2db4c6donarecbyv5begtj2bm",
    remove_metadata={
        "created_by": "jim",
        "priority": "medium",
    },
    remove_tags=["irs_2023", "personal"],
)