From a065597d572a3a209f43828ae3d4bb1f943e5bc8 Mon Sep 17 00:00:00 2001 From: Marvin Pohl Date: Fri, 20 Dec 2019 10:44:16 +0100 Subject: [PATCH] Bring auth.py to PEP-8 standard. --- buildbot_gitea/auth.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/buildbot_gitea/auth.py b/buildbot_gitea/auth.py index eb8f1d5..aa4d0ec 100644 --- a/buildbot_gitea/auth.py +++ b/buildbot_gitea/auth.py @@ -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') \ No newline at end of file + return self.get(c, '/api/v1/user')