From ae514a84c400586c4fda43e1342187ab10f2413b Mon Sep 17 00:00:00 2001 From: "Antoine R. Dumont (@ardumont)" Date: Fri, 5 Oct 2018 11:45:42 +0200 Subject: [PATCH] gitlab.lister: Do not expect gitlab instances to have credentials Only the main gitlab.com instance supports a rate limit (thus the credentials need), others do not (as per summer 2018). --- swh/lister/gitlab/lister.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/swh/lister/gitlab/lister.py b/swh/lister/gitlab/lister.py index d24d773..e502630 100644 --- a/swh/lister/gitlab/lister.py +++ b/swh/lister/gitlab/lister.py @@ -59,11 +59,9 @@ class GitLabLister(PageByPageHttpLister): params = { 'headers': self.request_headers() or {} } - # Retrieve the credentials per instance - creds = self.config['credentials'] - if creds: - creds_lister = creds[self.instance] - auth = random.choice(creds_lister) if creds else None + creds_lister = self.config['credentials'].get(self.instance) + if creds_lister: + auth = random.choice(creds_lister) if auth: params['auth'] = (auth['username'], auth['password']) return params