diff options
author | Vilem Duha <vilem.duha@gmail.com> | 2019-06-17 01:10:54 +0300 |
---|---|---|
committer | Vilem Duha <vilem.duha@gmail.com> | 2019-06-17 17:14:11 +0300 |
commit | 4fff91efbaf10360e0618338c8cb6ce4795b8f5f (patch) | |
tree | 3ff1d9bbccbd8e890877b5f0dc622619b782ae86 /blenderkit/oauth.py | |
parent | 8009a267b8bb7a5ab020bc72f36e2bfa0500e680 (diff) |
BlenderKit: better reporting for failed uploads
bugfix - only fetch server data when not in background(fetching api key during upload procedure is a very bad idea)
updatea oauth script.
Mention Petr Dlouhy as co-author
Temporarily enable Api key field also with oauth on.
Diffstat (limited to 'blenderkit/oauth.py')
-rw-r--r-- | blenderkit/oauth.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/blenderkit/oauth.py b/blenderkit/oauth.py index 220dbed4..3a37318a 100644 --- a/blenderkit/oauth.py +++ b/blenderkit/oauth.py @@ -55,6 +55,7 @@ class SimpleOAuthAuthenticator(object): def get_new_token(self, register=True, redirect_url=None): class HTTPServerHandler(BaseHTTPRequestHandler): + html_template = '<html>%(head)s<h1>%(message)s</h1></html>' def do_GET(self): self.send_response(200) self.send_header('Content-type', 'text/html') @@ -69,9 +70,11 @@ class SimpleOAuthAuthenticator(object): ) else: redirect_string = "" - self.wfile.write(bytes('<html>%s<h1>You may now close this window.</h1></html>' % redirect_string, 'utf-8')) + self.wfile.write(bytes(self.html_template % {'head': redirect_string, 'message': 'You may now close this window.'}, 'utf-8')) qs = parse_qs(urlparse(self.path).query) self.server.authorization_code = qs['code'][0] + else: + self.wfile.write(bytes(self.html_template % {'head': '', 'message': 'Authorization failed.'}, 'utf-8')) for port in self.ports: try: |