Changeset View
Changeset View
Standalone View
Standalone View
docs/README.rst
Software Heritage - Web client | Software Heritage - Web client | ||||
============================== | ============================== | ||||
Client for Software Heritage Web applications, via their APIs. | Client for Software Heritage Web applications, via their APIs. | ||||
Sample usage | Sample usage | ||||
------------ | ------------ | ||||
.. code-block:: python | .. code-block:: python | ||||
from swh.web.client.client import WebAPIClient | from swh.web.client.client import WebAPIClient | ||||
cli = WebAPIClient() | cli = WebAPIClient() | ||||
# retrieve any archived object via its PID | # retrieve any archived object via its SWHID | ||||
cli.get('swh:1:rev:aafb16d69fd30ff58afdd69036a26047f3aebdc6') | cli.get('swh:1:rev:aafb16d69fd30ff58afdd69036a26047f3aebdc6') | ||||
# same, but for specific object types | # same, but for specific object types | ||||
cli.revision('swh:1:rev:aafb16d69fd30ff58afdd69036a26047f3aebdc6') | cli.revision('swh:1:rev:aafb16d69fd30ff58afdd69036a26047f3aebdc6') | ||||
# get() always retrieve entire objects, following pagination | # get() always retrieve entire objects, following pagination | ||||
# WARNING: this might *not* be what you want for large objects | # WARNING: this might *not* be what you want for large objects | ||||
cli.get('swh:1:snp:6a3a2cf0b2b90ce7ae1cf0a221ed68035b686f5a') | cli.get('swh:1:snp:6a3a2cf0b2b90ce7ae1cf0a221ed68035b686f5a') | ||||
# type-specific methods support explicit iteration through pages | # type-specific methods support explicit iteration through pages | ||||
next(cli.snapshot('swh:1:snp:cabcc7d7bf639bbe1cc3b41989e1806618dd5764')) | next(cli.snapshot('swh:1:snp:cabcc7d7bf639bbe1cc3b41989e1806618dd5764')) |