diff --git a/src/keys/lib/api_keys32.dll b/src/keys/lib/api_keys32.dll index 8e9749f8..f4acbe99 100644 Binary files a/src/keys/lib/api_keys32.dll and b/src/keys/lib/api_keys32.dll differ diff --git a/src/sessionmanager/sessionManager.py b/src/sessionmanager/sessionManager.py index eea48a7f..0e934578 100644 --- a/src/sessionmanager/sessionManager.py +++ b/src/sessionmanager/sessionManager.py @@ -50,7 +50,7 @@ class sessionManagerController(object): session.sessions[i] = s def manage_new_account(self): - location = (str(time.time())[:6]) + location = (str(time.time())[-6:]) log.debug("Creating session in the %s path" % (location,)) s = session.Session(location) manager.manager.add_session(location) diff --git a/src/twitter/twitter.py b/src/twitter/twitter.py index 82e6bb1b..baaa8a53 100644 --- a/src/twitter/twitter.py +++ b/src/twitter/twitter.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +import random import BaseHTTPServer import webbrowser from twython import Twython, TwythonError @@ -13,9 +14,11 @@ class twitter(object): self.credentials = self.twitter.verify_credentials() def authorise(self, settings): - httpd = BaseHTTPServer.HTTPServer(('127.0.0.1', 8080), authorisationHandler.handler) + authorisationHandler.logged = False + port = random.randint(30000, 66000) + httpd = BaseHTTPServer.HTTPServer(('127.0.0.1', port), authorisationHandler.handler) twitter = Twython(keyring.get("api_key"), keyring.get("api_secret"), auth_endpoint='authorize') - auth = twitter.get_authentication_tokens("http://127.0.0.1:8080") + auth = twitter.get_authentication_tokens("http://127.0.0.1:{0}".format(port,)) webbrowser.open_new_tab(auth['auth_url']) # global logged, verifier while authorisationHandler.logged == False: @@ -23,6 +26,7 @@ class twitter(object): self.twitter = Twython(keyring.get("api_key"), keyring.get("api_secret"), auth['oauth_token'], auth['oauth_token_secret']) final = self.twitter.get_authorized_tokens(authorisationHandler.verifier) self.save_configuration(settings, final["oauth_token"], final["oauth_token_secret"]) + httpd.server_close() def save_configuration(self, settings, user_key, user_secret): settings["twitter"]["user_key"] = user_key