Bring auth.py to PEP-8 standard.

This commit is contained in:
Marvin Pohl 2019-12-20 10:44:16 +01:00
parent bc8f00a7e6
commit a065597d57

View File

@ -1,15 +1,19 @@
from buildbot.www.oauth2 import OAuth2Auth
from urllib.parse import urljoin
class GiteaAuth(OAuth2Auth):
name = 'Gitea'
faIcon = 'mug-tea'
AUTH_URL = 'login/oauth/authorize'
TOKEN_URL = 'login/oauth/access_token'
def __init__(self, endpoint, client_id, client_secret):
super(__class__, self).__init__(client_id, client_secret)
super(GiteaAuth, self).__init__(client_id, client_secret)
self.resourceEndpoint = endpoint
self.authUri = urljoin(endpoint, 'login/oauth/authorize')
self.tokenUri = urljoin(endpoint, 'login/oauth/access_token')
self.authUri = urljoin(endpoint, self.AUTH_URL)
self.tokenUri = urljoin(endpoint, self.TOKEN_URL)
def getUserInfoFromOAuthClient(self, c):
return self.get(c, '/api/v1/user')