swh.lister.phabricator.lister module

class swh.lister.phabricator.lister.PhabricatorLister(scheduler: swh.scheduler.interface.SchedulerInterface, url: str, instance: Optional[str] = None, api_token: Optional[str] = None, credentials: Optional[Dict[str, Dict[str, List[Dict[str, str]]]]] = None)[source]

Bases: swh.lister.pattern.StatelessLister[List[Dict[str, Any]]]

List all repositories hosted on a Phabricator instance.

Parameters
  • url – base URL of a phabricator forge (for instance https://forge.softwareheritage.org)

  • instance – string identifier for the listed forge, URL network location will be used if not provided

  • api_token – authentication token for Conduit API

LISTER_NAME: str = 'phabricator'
API_REPOSITORY_PATH = '/api/diffusion.repository.search'
get_request_params(after: Optional[str]) Dict[str, str][source]

Get the query parameters for the request.

static filter_params(params: Dict[str, str]) Dict[str, str][source]

Filter the parameters for debug purposes

get_pages() Iterator[List[Dict[str, Any]]][source]

Retrieve a list of pages of listed results. This is the main loop of the lister.

Returns

an iterator of raw pages fetched from the platform currently being listed.

get_origins_from_page(page: List[Dict[str, Any]]) Iterator[swh.scheduler.model.ListedOrigin][source]

Extract a list of model.ListedOrigin from a raw page of results.

Parameters

page – a single page of results

Returns

an iterator for the origins present on the given page of results

swh.lister.phabricator.lister.get_repo_url(attachments: List[Dict[str, Any]]) Optional[str][source]

Return url for a hosted repository from its uris attachments according to the following priority lists: * protocol: https > http * identifier: shortname > callsign > id