Changeset View
Changeset View
Standalone View
Standalone View
swh/lister/gitlab/lister.py
Show All 10 Lines | |||||
class GitLabLister(PageByPageHttpLister): | class GitLabLister(PageByPageHttpLister): | ||||
# Template path expecting an integer that represents the page id | # Template path expecting an integer that represents the page id | ||||
PATH_TEMPLATE = '/projects?page=%d&order_by=id' | PATH_TEMPLATE = '/projects?page=%d&order_by=id' | ||||
DEFAULT_URL = 'https://gitlab.com/api/v4/' | DEFAULT_URL = 'https://gitlab.com/api/v4/' | ||||
MODEL = GitLabModel | MODEL = GitLabModel | ||||
LISTER_NAME = 'gitlab' | LISTER_NAME = 'gitlab' | ||||
def __init__(self, api_baseurl=None, instance=None, | def __init__(self, url=None, instance=None, | ||||
override_config=None, sort='asc', per_page=20): | override_config=None, sort='asc', per_page=20): | ||||
super().__init__(api_baseurl=api_baseurl, | super().__init__(url=url, override_config=override_config) | ||||
override_config=override_config) | |||||
if instance is None: | if instance is None: | ||||
instance = parse_url(self.api_baseurl).host | instance = parse_url(self.url).host | ||||
self.instance = instance | self.instance = instance | ||||
self.PATH_TEMPLATE = '%s&sort=%s&per_page=%s' % ( | self.PATH_TEMPLATE = '%s&sort=%s&per_page=%s' % ( | ||||
self.PATH_TEMPLATE, sort, per_page) | self.PATH_TEMPLATE, sort, per_page) | ||||
def uid(self, repo): | def uid(self, repo): | ||||
return '%s/%s' % (self.instance, repo['path_with_namespace']) | return '%s/%s' % (self.instance, repo['path_with_namespace']) | ||||
def get_model_from_repo(self, repo): | def get_model_from_repo(self, repo): | ||||
▲ Show 20 Lines • Show All 50 Lines • Show Last 20 Lines |