client: Open last_visit method to retrieve last visit of an origin
Closed
requested to merge generated-differential-D6211-source into generated-differential-D6211-target
This would allow to script retrieve the last swhid of an object [1] by composing multiple calls from the client [2]
-
[2]
from swh.web.client.client import WebAPIClient
client = WebAPIClient()
url = "https://doi.org/10.5201/ipol.2018.236"
visit = client.last_visit(url)
# if visit...
snapshot = next(client.snapshot(visit["snapshot"]))
# if snapshot ...
revision = client.revision(snapshot['HEAD']['target'])
# ensure target_type == 'revision'
# if revision
In [17]: str(revision['directory'])
Out[17]: 'swh:1:dir:d85591aeefea2c1c58142e34683fd1923b19c895'
Related to swh-deposit#3192 (closed)
Test Plan
tox
Migrated from D6211 (view on Phabricator)
Merge request reports
Activity
Filter activity
Build is green
Patch application report for D6211 (id=22480)
Rebasing onto d1f064f1...
Current branch diff-target is up to date.
Changes applied before test
commit 3806eaba8430a2e9886985063f14382b42b5d882 Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org> Date: Wed Sep 8 12:34:11 2021 +0200 client: Open last_visit method to retrieve last visit of an origin Related to swh/devel/swh-deposit#3192
See https://jenkins.softwareheritage.org/job/DWCLI/job/tests-on-diff/51/ for more details.
Some references in the commit message have been migrated:
- T3192 is now swh-deposit#3192 (closed)
Build is green
Patch application report for D6211 (id=22481)
Rebasing onto d1f064f1...
Current branch diff-target is up to date.
Changes applied before test
commit 32b05c4581ea4beb8866cdb327ece58e723771cb Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org> Date: Wed Sep 8 12:34:11 2021 +0200 client: Open last_visit method to retrieve last visit of an origin Related to swh/devel/swh-deposit#3192
See https://jenkins.softwareheritage.org/job/DWCLI/job/tests-on-diff/52/ for more details.
mentioned in issue swh-deposit#3192 (closed)
mentioned in merge request swh-deposit!264 (closed)
Please register or sign in to reply