diff --git a/swh/lister/gitlab/lister.py b/swh/lister/gitlab/lister.py --- a/swh/lister/gitlab/lister.py +++ b/swh/lister/gitlab/lister.py @@ -59,11 +59,9 @@ 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