From 18b68bd8c7894933c0fea2a8b7c92d485dd03294 Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Tue, 27 Apr 2021 18:13:09 +0200 Subject: [PATCH] s/REST( API)?/API/ Bitbucket's API kind of supports REST workflows, but the clearly use it like an RPC API (the hardcoded schema in `PROJECT_API_URL_FORMAT` make it particularly clear) --- swh/lister/bitbucket/lister.py | 2 +- swh/lister/sourceforge/lister.py | 8 ++++---- swh/lister/sourceforge/tests/test_lister.py | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/swh/lister/bitbucket/lister.py b/swh/lister/bitbucket/lister.py index f550003..edc4e0e 100644 --- a/swh/lister/bitbucket/lister.py +++ b/swh/lister/bitbucket/lister.py @@ -34,7 +34,7 @@ class BitbucketListerState: class BitbucketLister(Lister[BitbucketListerState, List[Dict[str, Any]]]): - """List origins from Bitbucket using its REST API. + """List origins from Bitbucket using its API. Bitbucket API has the following rate-limit configuration: diff --git a/swh/lister/sourceforge/lister.py b/swh/lister/sourceforge/lister.py index ae902b0..ec1db9f 100644 --- a/swh/lister/sourceforge/lister.py +++ b/swh/lister/sourceforge/lister.py @@ -50,12 +50,12 @@ SourceForgeListerPage = List[SourceForgeListerEntry] MAIN_SITEMAP_URL = "https://sourceforge.net/allura_sitemap/sitemap.xml" SITEMAP_XML_NAMESPACE = "{http://www.sitemaps.org/schemas/sitemap/0.9}" -# REST resource endpoint for information about the given project. +# API resource endpoint for information about the given project. # # `namespace`: Project namespace. Very often `p`, but can be something else like # `adobe` # `project`: Project name, e.g. `seedai`. Can be a subproject, e.g `backapps/website`. -PROJECT_REST_URL_FORMAT = "https://sourceforge.net/rest/{namespace}/{project}" +PROJECT_API_URL_FORMAT = "https://sourceforge.net/rest/{namespace}/{project}" # Predictable URL for cloning (in the broad sense) a VCS registered for the project. # @@ -116,7 +116,7 @@ class SourceForgeLister(StatelessLister[SourceForgeListerPage]): projects. Each XML sub-sitemap lists project pages, which are not unique per project: a project can have a wiki, a home, a git, an svn, etc. - For each unique project, we query a REST endpoint that lists (among + For each unique project, we query an API endpoint that lists (among other things) the tools associated with said project, some of which are the VCS used. Subprojects are considered separate projects. Lastly we use the information of which VCS are used to build the predictable @@ -196,7 +196,7 @@ class SourceForgeLister(StatelessLister[SourceForgeListerPage]): def _get_pages_for_project( self, namespace, project, last_modified ) -> SourceForgeListerPage: - endpoint = PROJECT_REST_URL_FORMAT.format(namespace=namespace, project=project) + endpoint = PROJECT_API_URL_FORMAT.format(namespace=namespace, project=project) res = self.page_request(endpoint, {}).json() tools = res.get("tools") diff --git a/swh/lister/sourceforge/tests/test_lister.py b/swh/lister/sourceforge/tests/test_lister.py index 39bc163..0c1f226 100644 --- a/swh/lister/sourceforge/tests/test_lister.py +++ b/swh/lister/sourceforge/tests/test_lister.py @@ -13,7 +13,7 @@ from requests.exceptions import HTTPError from swh.lister import USER_AGENT from swh.lister.sourceforge.lister import ( MAIN_SITEMAP_URL, - PROJECT_REST_URL_FORMAT, + PROJECT_API_URL_FORMAT, SourceForgeLister, ) @@ -28,7 +28,7 @@ TEST_PROJECTS = { } URLS_MATCHER = { - PROJECT_REST_URL_FORMAT.format(namespace=namespace, project=project): project + PROJECT_API_URL_FORMAT.format(namespace=namespace, project=project): project for project, namespace in TEST_PROJECTS.items() }