Page MenuHomeSoftware Heritage

Add possibility to fetch a list of deposits on the deposit cli
Closed, MigratedEdits Locked

Description

To provide a way to have a list of deposit for a client.
It will be good to filter the deposit by collection, client, deposit type (metadata-only).

Event Timeline

moranegg triaged this task as Normal priority.Jan 26 2021, 11:43 AM
moranegg created this task.

Discussed for 2021W18 or 2021W19 during today's call.

Deployed on staging.

It fails with errors on the response headers somehow [1] though.

Investigating.

[1]https://sentry.softwareheritage.org/share/issue/919e0881b3094bcdbf112131615ac05f/

Found the issue. Hot-fixing the staging instance, the listing now works (through curl or cli).

[1] P1052

Deployed for both staging and production.

Use:

$ swh deposit list --help
WARNING:swh.core.cli:Could not load subcommand scanner: swh-scanner
Usage: swh deposit list [OPTIONS]

  Deposit metadata only upload



Options:
  --url TEXT                      (Optional) Deposit server api endpoint. By
                                  default,
                                  https://deposit.softwareheritage.org/1

  --username TEXT                 (Mandatory) User's name  [required]
  --password TEXT                 (Mandatory) User's associated password
                                  [required]

  -f, --format [logging|yaml|json]
                                  Output format results.
  --page INTEGER                  Page number when requesting more information
  --page-size INTEGER             Page number when requesting more information
  -h, --help                      Show this message and exit.

Example:

$ swh deposit list --url http://deposit.softwareheritage.org/1 \
  --username swh \
  --password $(swhpass ls operations/deposit.softwareheritage.org/http-auth/swh | head -1) \
  --format json --page 1 --page-size 1 | jq .
{
  "count": "702",
  "deposits": [
    {
      "id": "91",
      "reception_date": "2018-02-01T11:05:12.913914Z",
      "complete_date": "2018-02-01T11:05:12.903791Z",
      "external_id": "je-suis-gpl",
      "swhid": "swh:1:dir:e3e9c6380aae01b52a4d814200a9b65c87d0470b",
      "status": "done",
      "swhid_context": "swh:1:dir:e3e9c6380aae01b52a4d814200a9b65c87d0470b;origin=https://forge.softwareheritage.org/source/jesuisgpl/;visit=swh:1:snp:01f5d769ce5d76a4063f42c6a3f929144206fc66;anchor=swh:1:rev:a86747d201ab8f8657d145df4376676d5e47cf9f;path=/",
      "origin_url": "https://www.softwareheritage.org/je-suis-gpl"
    }
  ],
  "next": "https://deposit.softwareheritage.org/1/swh/?page=2&page_size=1"
}
$ swh deposit list --url http://deposit.softwareheritage.org/1 \
  --username swh \
  --password $(swhpass ls operations/deposit.softwareheritage.org/http-auth/swh | head -1) \
  --format json --page 2 --page-size 1 | jq .
{
  "count": "702",
  "deposits": [
    {
      "id": "149",
      "reception_date": "2018-07-12T08:40:11.535703Z",
      "complete_date": "2018-07-12T08:40:11.530841Z",
      "external_id": "external-id",
      "swhid": "swh:1:dir:549429eae3f5c9b3f515bf8093b61dd08fa80630",
      "status": "done",
      "swhid_context": "swh:1:dir:549429eae3f5c9b3f515bf8093b61dd08fa80630;origin=https://www.softwareheritage.org/external-id;visit=swh:1:snp:cb84ede1d6bf0297093ba35eac07be38ebe80eb2;anchor=swh:1:rev:7e264ccffdad3bd73d6c6a2cbb13677f65e3ea31;path=/",
      "origin_url": "https://www.softwareheritage.org/external-id"
    }
  ],
  "next": "https://deposit.softwareheritage.org/1/swh/?page=3&page_size=1",
  "previous": "https://deposit.softwareheritage.org/1/swh/?page_size=1"
}
ardumont moved this task from In progress to Deployed on the SWORD deposit board.