From dceaeb7452c893905f78c6378463fedf480074e2 Mon Sep 17 00:00:00 2001 From: Klaus-Uwe Mitterer Date: Sun, 26 Feb 2017 20:12:21 +0100 Subject: [PATCH] Add function to authenticate with known cke/cse pair --- twitools/__init__.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/twitools/__init__.py b/twitools/__init__.py index e0439b3..005ed29 100644 --- a/twitools/__init__.py +++ b/twitools/__init__.py @@ -24,6 +24,25 @@ class twObject: def tweet(self, text, reply = 0): return self.api.update_status(text, reply) + def authenticate(self): + try: + authurl = self.auth.get_authorization_url() + except tweepy.TweepError: + return False + + print(authurl) + print() + + pin = input("PIN: ") + print() + + try: + self.auth.get_access_token(pin) + except tweepy.TweepError: + return False + + return self.auth.access_token, self.auth.access_token_secret + def getFollowerIDs(section = setuptools.TWITTER): ''' Returns 5,000 follower IDs at most ''' for id in list(twoHelper(section).api.followers_ids(screen_name=twObject().whoami())):