mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-22 11:18:08 -06:00
Setting up multiple accounts using the session manager
This commit is contained in:
parent
188d95ad6c
commit
632e54a727
Binary file not shown.
@ -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)
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user