Changeset View
Changeset View
Standalone View
Standalone View
swh/lister/gitlab/lister.py
| Show All 37 Lines | def ADDITIONAL_CONFIG(self): | ||||
| default_config['credentials'] = ('dict', {}) | default_config['credentials'] = ('dict', {}) | ||||
| return default_config | return default_config | ||||
| def request_params(self, identifier): | def request_params(self, identifier): | ||||
| """Get the full parameters passed to requests given the | """Get the full parameters passed to requests given the | ||||
| transport_request identifier. | transport_request identifier. | ||||
| For the gitlab lister, the 'credentials' entries is configured | For the gitlab lister, the 'credentials' entries is configured | ||||
| per instance. For example: | per instance. For example:: | ||||
| - credentials: | - credentials: | ||||
| - gitlab.com: | - gitlab.com: | ||||
| - username: user0 | - username: user0 | ||||
| password: <pass> | password: <pass> | ||||
| - username: user1 | - username: user1 | ||||
| password: <pass> | password: <pass> | ||||
| - ... | - ... | ||||
| - other-gitlab-instance: | - other-gitlab-instance: | ||||
| ... | ... | ||||
| """ | """ | ||||
| params = { | params = { | ||||
| 'headers': self.request_headers() or {} | 'headers': self.request_headers() or {} | ||||
| } | } | ||||
| creds_lister = self.config['credentials'].get(self.instance) | creds_lister = self.config['credentials'].get(self.instance) | ||||
| if creds_lister: | if creds_lister: | ||||
| auth = random.choice(creds_lister) | auth = random.choice(creds_lister) | ||||
| ▲ Show 20 Lines • Show All 59 Lines • Show Last 20 Lines | |||||