Changeset View
Changeset View
Standalone View
Standalone View
swh/lister/npm/lister.py
Show First 20 Lines • Show All 111 Lines • ▼ Show 20 Lines | |||||
class NpmIncrementalLister(NpmListerBase): | class NpmIncrementalLister(NpmListerBase): | ||||
"""List packages in the npm registry, updated since a specific | """List packages in the npm registry, updated since a specific | ||||
update_seq value of the underlying CouchDB database, in a paginated way | update_seq value of the underlying CouchDB database, in a paginated way | ||||
""" | """ | ||||
PATH_TEMPLATE = '/_changes?since=%s' | PATH_TEMPLATE = '/_changes?since=%s' | ||||
@property | @property | ||||
def CONFIG_BASE_FILENAME(self): # noqa: N802 | def CONFIG_BASE_FILENAME(self): # noqa: N802 | ||||
return 'lister-npm-incremental' | return 'lister_npm_incremental' | ||||
def get_next_target_from_response(self, response): | def get_next_target_from_response(self, response): | ||||
"""(Override) Get next npm package name to continue the listing | """(Override) Get next npm package name to continue the listing | ||||
""" | """ | ||||
repos = response.json()['results'] | repos = response.json()['results'] | ||||
return repos[-1]['seq'] if len(repos) == self.per_page else None | return repos[-1]['seq'] if len(repos) == self.per_page else None | ||||
Show All 29 Lines |