This would allow to script retrieve the last swhid of an object [1] by composing
multiple calls from the client [2]
[1] T3192#69844
[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 T3192