Changeset View
Changeset View
Standalone View
Standalone View
swh/lister/golang/lister.py
Show All 38 Lines | class GolangLister(Lister[GolangStateType, GolangPageType]): | ||||
The lister queries the Golang module index, whose documentation can be found | The lister queries the Golang module index, whose documentation can be found | ||||
at https://index.golang.org | at https://index.golang.org | ||||
""" | """ | ||||
GOLANG_MODULES_INDEX_URL = "https://index.golang.org/index" | GOLANG_MODULES_INDEX_URL = "https://index.golang.org/index" | ||||
# `limit` seems to be... limited to 2000. | # `limit` seems to be... limited to 2000. | ||||
GOLANG_MODULES_INDEX_LIMIT = 2000 | GOLANG_MODULES_INDEX_LIMIT = 2000 | ||||
LISTER_NAME = "Golang" | LISTER_NAME = "golang" | ||||
def __init__( | def __init__( | ||||
self, | self, | ||||
scheduler: SchedulerInterface, | scheduler: SchedulerInterface, | ||||
incremental: bool = False, | incremental: bool = False, | ||||
credentials: CredentialsType = None, | credentials: CredentialsType = None, | ||||
): | ): | ||||
super().__init__( | super().__init__( | ||||
scheduler=scheduler, | scheduler=scheduler, | ||||
url=self.GOLANG_MODULES_INDEX_URL, | url=self.GOLANG_MODULES_INDEX_URL, | ||||
instance="Golang", | instance=self.LISTER_NAME, | ||||
credentials=credentials, | credentials=credentials, | ||||
) | ) | ||||
self.session = requests.Session() | self.session = requests.Session() | ||||
self.session.headers.update( | self.session.headers.update( | ||||
{"Accept": "application/json", "User-Agent": USER_AGENT} | {"Accept": "application/json", "User-Agent": USER_AGENT} | ||||
) | ) | ||||
self.incremental = incremental | self.incremental = incremental | ||||
▲ Show 20 Lines • Show All 122 Lines • Show Last 20 Lines |