diff --git a/swh/lister/dlang/__init__.py b/swh/lister/dlang/__init__.py index 8cd517ddfe200f2a89f193465475bceee45ac798..c8f100f37634409ef8ff59975c345bbc88754f49 100644 --- a/swh/lister/dlang/__init__.py +++ b/swh/lister/dlang/__init__.py @@ -22,7 +22,7 @@ Origins retrieving strategy --------------------------- To build a list of origins we make a GET request to an `http api endpoint`_ that returns -a Json array of objects. +a JSON-formatted array of objects. The origin url for each package is constructed with the information of corresponding `repository` entry which represents Git based projects hosted on Github, GitLab or Bitbucket. diff --git a/swh/lister/dlang/lister.py b/swh/lister/dlang/lister.py index 65afad446823b1a6d14c63c7c81f29301dec5a6a..34150923e9696add0a299fe6ee2507d5c6f54a42 100644 --- a/swh/lister/dlang/lister.py +++ b/swh/lister/dlang/lister.py @@ -27,18 +27,19 @@ class DlangLister(StatelessLister[DlangListerPage]): INSTANCE = "dlang" BASE_URL = "https://code.dlang.org" - PACKAGES_DUMP_URL = BASE_URL + "/api/packages/dump" + PACKAGES_DUMP_URL_PATTERN = "{url}/api/packages/dump" KINDS = { "github": "https://github.com", "gitlab": "https://gitlab.com", "bitbucket": "https://bitbucket.com", } - KIND_URL_PATTERN = "{url}/{owner}/{project}" def __init__( self, scheduler: SchedulerInterface, + url: str = BASE_URL, + instance: str = INSTANCE, credentials: Optional[CredentialsType] = None, max_origins_per_page: Optional[int] = None, max_pages: Optional[int] = None, @@ -47,8 +48,8 @@ class DlangLister(StatelessLister[DlangListerPage]): super().__init__( scheduler=scheduler, credentials=credentials, - instance=self.INSTANCE, - url=self.PACKAGES_DUMP_URL, + instance=instance, + url=self.PACKAGES_DUMP_URL_PATTERN.format(url=url), max_origins_per_page=max_origins_per_page, max_pages=max_pages, enable_origins=enable_origins,