ftrack_api.accessor.base

class ftrack_api.accessor.base.Accessor[source]

Provide data access to a location.

A location represents a specific storage, but access to that storage may vary. For example, both local filesystem and FTP access may be possible for the same storage. An accessor implements these different ways of accessing the same data location.

As different accessors may access the same location, only part of a data path that is commonly understood may be stored in the database. The format of this path should be a contract between the accessors that require access to the same location and is left as an implementation detail. As such, this system provides no guarantee that two different accessors can provide access to the same location, though this is a clear goal. The path stored centrally is referred to as the resource identifier and should be used when calling any of the accessor methods that accept a resource_identifier argument.

__init__()[source]

Initialise location accessor.

abstract list(resource_identifier)[source]

Return list of entries in resource_identifier container.

Each entry in the returned list should be a valid resource identifier.

Raise AccessorResourceNotFoundError if resource_identifier does not exist or AccessorResourceInvalidError if resource_identifier is not a container.

abstract exists(resource_identifier)[source]

Return if resource_identifier is valid and exists in location.

abstract is_file(resource_identifier)[source]

Return whether resource_identifier refers to a file.

abstract is_container(resource_identifier)[source]

Return whether resource_identifier refers to a container.

abstract is_sequence(resource_identifier)[source]

Return whether resource_identifier refers to a file sequence.

abstract open(resource_identifier, mode='rb')[source]

Return Data for resource_identifier.

abstract remove(resource_identifier)[source]

Remove resource_identifier.

Raise AccessorResourceNotFoundError if resource_identifier does not exist.

abstract make_container(resource_identifier, recursive=True)[source]

Make a container at resource_identifier.

If recursive is True, also make any intermediate containers.

Should silently ignore existing containers and not recreate them.

abstract get_container(resource_identifier)[source]

Return resource_identifier of container for resource_identifier.

Raise AccessorParentResourceNotFoundError if container of resource_identifier could not be determined.

remove_container(resource_identifier)[source]

Remove container at resource_identifier.

get_filesystem_path(resource_identifier)[source]

Return filesystem path for resource_identifier.

Raise AccessorFilesystemPathError if filesystem path could not be determined from resource_identifier or AccessorUnsupportedOperationError if retrieving filesystem paths is not supported by this accessor.

get_url(resource_identifier)[source]

Return URL for resource_identifier.

Raise AccessorFilesystemPathError if URL could not be determined from resource_identifier or AccessorUnsupportedOperationError if retrieving URL is not supported by this accessor.