Show dialog while waiting for account authorisation. Possibly fixes #101. Needs tests

This commit is contained in:
2017-07-30 04:05:32 -05:00
parent 5a249ba942
commit 76582c6313
3 changed files with 43 additions and 4 deletions

View File

@@ -2,11 +2,12 @@
import BaseHTTPServer
import application
from urlparse import urlparse, parse_qs
from pubsub import pub
logged = False
verifier = None
class handler(BaseHTTPServer.BaseHTTPRequestHandler):
class handler(BaseHTTPServer.BaseHTTPRequestHandler, object):
def do_GET(self):
global logged
@@ -18,4 +19,14 @@ class handler(BaseHTTPServer.BaseHTTPRequestHandler):
global verifier
verifier = params.get('oauth_verifier', [None])[0]
self.wfile.write(u"You have successfully logged into Twitter with {0}. You can close this window now.".format(application.name))
pub.sendMessage("authorisation-accepted")
pub.unsubscribe(self.cancelled, "authorisation-cancelled")
self.finish()
def __init__(self, *args, **kwargs):
pub.subscribe(self.cancelled, "authorisation-cancelled")
super(handler, self).__init__(*args, **kwargs)
def cancelled(self):
pub.unsubscribe(self.cancelled, "authorisation-cancelled")
self.finish()