mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2025-07-18 14:06:07 -04:00
A new library for storing app keys is added
This commit is contained in:
@@ -2,24 +2,25 @@
|
||||
import BaseHTTPServer
|
||||
import webbrowser
|
||||
from twython import Twython, TwythonError
|
||||
import application
|
||||
from keys import keyring
|
||||
import authorisationHandler
|
||||
|
||||
|
||||
class twitter(object):
|
||||
|
||||
def login(self, user_key, user_secret):
|
||||
self.twitter = Twython(application.app_key, application.app_secret, user_key, user_secret)
|
||||
self.twitter = Twython(keyring.get("api_key"), keyring.get("api_secret"), user_key, user_secret)
|
||||
self.credentials = self.twitter.verify_credentials()
|
||||
|
||||
def authorise(self, settings):
|
||||
httpd = BaseHTTPServer.HTTPServer(('127.0.0.1', 8080), authorisationHandler.handler)
|
||||
twitter = Twython(application.app_key, application.app_secret, auth_endpoint='authorize')
|
||||
twitter = Twython(keyring.get("app_key"), keyring.get("app_secret"), auth_endpoint='authorize')
|
||||
auth = twitter.get_authentication_tokens("http://127.0.0.1:8080")
|
||||
webbrowser.open_new_tab(auth['auth_url'])
|
||||
# global logged, verifier
|
||||
while authorisationHandler.logged == False:
|
||||
httpd.handle_request()
|
||||
self.twitter = Twython(application.app_key, application.app_secret, auth['oauth_token'], auth['oauth_token_secret'])
|
||||
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"])
|
||||
|
||||
|
Reference in New Issue
Block a user