connect.bundles

connect.bundles

Bundle resources.

Classes

Name Description
Bundle
BundleMetadata
Bundles Bundles resource.

Bundle

connect.bundles.Bundle(self, /, params, **kwargs)

Attributes

Name Description
metadata

Methods

Name Description
delete Delete the bundle.
deploy Deploy the bundle.
download Download a bundle.
delete
connect.bundles.Bundle.delete()

Delete the bundle.

deploy
connect.bundles.Bundle.deploy()

Deploy the bundle.

Spawns an asynchronous task, which activates the bundle.

Returns
Name Type Description
tasks.Task The task for the deployment.
Examples
>>> task = bundle.deploy()
>>> task.wait_for()
None
download
connect.bundles.Bundle.download(output)

Download a bundle.

Download a bundle to a file or memory.

Parameters
Name Type Description Default
output io.BufferedWriter or str An io.BufferedWriter instance or a str representing a relative or absolute path. required
Raises
Name Type Description
TypeError If the output is not of type io.BufferedWriter or str.
Examples

Write to a file.

>>> bundle.download("bundle.tar.gz")
None

Write to an io.BufferedWriter.

>>> with open('bundle.tar.gz', 'wb') as file:
>>>     bundle.download(file)
None

BundleMetadata

connect.bundles.BundleMetadata(self, /, params, **kwargs)

Bundles

connect.bundles.Bundles(self, params, content_guid)

Bundles resource.

Parameters

Name Type Description Default
config config.Config Configuration object. required
session requests.Session HTTP session object. required
content_guid str Content GUID associated with the bundles. required

Attributes

Name Type Description
content_guid str Content GUID associated with the bundles.

Methods

Name Description
create Create a bundle.
find Find all bundles.
find_one Find a bundle.
get Get a bundle.
create
connect.bundles.Bundles.create(archive)

Create a bundle.

Create a bundle from a file or memory.

Parameters
Name Type Description Default
archive io.BufferedReader, bytes, or str Archive for bundle creation. A ‘str’ type assumes a relative or absolute filepath. required
Returns
Name Type Description
Bundle The created bundle.
Raises
Name Type Description
TypeError If the input is not of type io.BufferedReader, bytes, or str.
Examples

Create a bundle from io.BufferedReader

>>> with open('bundle.tar.gz', 'rb') as file:
>>>     bundle.create(file)
None

Create a bundle from bytes.

>>> with open('bundle.tar.gz', 'rb') as file:
>>>     data: bytes = file.read()
>>>     bundle.create(data)
None

Create a bundle from pathname.

>>> bundle.create("bundle.tar.gz")
None
find
connect.bundles.Bundles.find()

Find all bundles.

Returns
Name Type Description
list of Bundle List of all found bundles.
find_one
connect.bundles.Bundles.find_one()

Find a bundle.

Returns
Name Type Description
Bundle | None The first found bundle | None if no bundles are found.
get
connect.bundles.Bundles.get(uid)

Get a bundle.

Parameters
Name Type Description Default
uid str Identifier of the bundle to retrieve. required
Returns
Name Type Description
Bundle The bundle with the specified ID.