Esempio n. 1
0
 def get_api(self, account):
     credentials = account.get_credentials()
     ACCESS_KEY = credentials.username
     ACCESS_SECRET = credentials.password
     auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
     auth.set_access_token(ACCESS_KEY, ACCESS_SECRET)
     return tweepy.API(auth)
def main():
    #Ask for permissions and set the pin
    auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
    auth_url = auth.get_authorization_url()
    print 'Please authorize in your browser'

    webbrowser.open(auth_url)
    verifier = raw_input('PIN: ').strip()
    auth.get_access_token(verifier)
    ACCESS_KEY = auth.access_token.key
    ACCESS_SECRET = auth.access_token.secret
    print "ACCESS_KEY: " + ACCESS_KEY
    print "ACCESS_SECRET: " + ACCESS_SECRET
    #Access to twitter with the access keys
    auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
    auth.set_access_token(ACCESS_KEY, ACCESS_SECRET)
    api = tweepy.API(auth)
    #api.update_status("Testing cloudsn with tweety")
    public_tweets = api.public_timeline()
    for tweet in public_tweets:
        print tweet.text
Esempio n. 3
0
 def load(self):
     self.builder=gtk.Builder()
     self.builder.set_translation_domain("cloudsn")
     self.builder.add_from_file(config.add_data_prefix("twitter-account.ui"))
     self.box = self.builder.get_object("container")
     self.permission_button = self.builder.get_object("permission_button")
     self.pin_entry = self.builder.get_object("pin_entry")
     
     self.auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
     auth_url = self.auth.get_authorization_url()
     self.permission_button.set_uri(auth_url)
     
     self.builder.connect_signals(self)
     if self.account:
         #Do not support editting
         pass
     return self.box