swh.deposit.api.private.deposit_read module#

swh.deposit.api.private.deposit_read.aggregate_tarballs(extraction_dir: str, archives: List) Iterator[str][source]#
Aggregate multiple tarballs into one and returns this new archive’s

path.

Parameters:
  • extraction_dir – Path to use for the tarballs computation

  • archive_paths – Deposit’s archive paths

Returns:

Tuple (directory to clean up, archive path (aggregated or not))

class swh.deposit.api.private.deposit_read.APIReadArchives[source]#

Bases: APIPrivateView, APIGet, DepositReadMixin

Dedicated class to read a deposit’s raw archives content.

Only GET is supported.

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

process_get(request, collection_name: str, deposit: Deposit) Tuple[int, Any, str][source]#
Build a unique tarball from the multiple received and stream that

content to the client.

Parameters:
  • request (Request) –

  • collection_name – Collection owning the deposit

  • deposit – Deposit concerned by the reading

Returns:

Tuple status, stream of content, content-type

class swh.deposit.api.private.deposit_read.APIReadMetadata[source]#

Bases: APIPrivateView, APIGet, DepositReadMixin

Class in charge of aggregating metadata on a deposit.

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

metadata_read(deposit: Deposit) Dict[str, Any][source]#

Read and aggregate multiple deposit information into one unified dictionary.

Parameters:

deposit – Deposit to retrieve information from

Returns:

Dictionary of deposit information read by the deposit loader, with the following keys:

origin (Dict): Information about the origin

raw_metadata (str): List of raw metadata received for the

deposit

provider (Dict): the metadata provider information about the

deposit client

tool (Dict): the deposit information

deposit (Dict): deposit information relevant to build the revision

(author_date, committer_date, etc…)

process_get(request, collection_name: str, deposit: Deposit) Tuple[int, Dict, str][source]#

Routine to deal with the deposit’s get processing.

Returns:

Tuple status, stream of content, content-type