Changeset View
Changeset View
Standalone View
Standalone View
swh/web/client/client.py
# Copyright (C) 2019-2020 The Software Heritage developers | # Copyright (C) 2019-2020 The Software Heritage developers | ||||
# See the AUTHORS file at the top-level directory of this distribution | # See the AUTHORS file at the top-level directory of this distribution | ||||
# License: GNU General Public License version 3, or any later version | # License: GNU General Public License version 3, or any later version | ||||
# See top-level LICENSE file for more information | # See top-level LICENSE file for more information | ||||
"""Python client for the Software Heritage Web API | """Python client for the Software Heritage Web API | ||||
Light wrapper around requests for the archive API, taking care of data | Light wrapper around requests for the archive API, taking care of data | ||||
conversions and pagination. | conversions and pagination. | ||||
.. code-block:: python | .. code-block:: python | ||||
from swh.web.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 PID | ||||
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') | ||||
▲ Show 20 Lines • Show All 454 Lines • Show Last 20 Lines |