コード例 #1
0
def __phase1_cb(oauth, info):
    print '[OK] phase1: request-downloaded'

    url = TwrOauth.AUTHORIZATION_URL % info['oauth_token']
    print 'Please visit %s' % url
    verifier = raw_input('verifier: ')

    TwrAccount.set_secrets(consumer_key, consumer_secret, info['oauth_token'],
                           info['oauth_token_secret'])

    oauth.connect('access-downloaded', __phase2_cb)
    oauth.connect('access-downloaded-failed', __phase2_failed_cb)
    oauth.access_token(verifier)
コード例 #2
0
def __phase2_cb(oauth, info):
    print '[OK] phase2: access-downloaded.'

    TwrAccount.set_secrets(consumer_key, consumer_secret, info['oauth_token'],
                           info['oauth_token_secret'])

    message = '''
    Replace these values to run the remaining tests:
    consumer_key = \'%s\'
    consumer_secret = \'%s\'
    access_key = \'%s\'
    access_secret = \'%s\'
    '''
    print message % (consumer_key, consumer_secret, info['oauth_token'],
                     info['oauth_token_secret'])

    loop.quit()
コード例 #3
0
import random
import string

from gi.repository import GObject

sys.path.append("..")
from twitter.twr_timeline import TwrTimeline
from twitter.twr_account import TwrAccount

consumer_key = ''
consumer_secret = ''

access_key = ''
access_secret = ''

TwrAccount.set_secrets(consumer_key, consumer_secret, access_key,
                       access_secret)


def __phase2_failed_cb(timeline, message):
    print '[FAILED] phase2: timeline-downloaded-failed with %s' % message
    loop.quit()


def __phase1_failed_cb(timeline, message):
    print '[FAILED] phase1: mentions-downloaded-failed with %s' % message
    loop.quit()


def __phase2_cb(timeline, info):
    print '[OK] phase2: timeline-downloaded, count: %d' % len(info)
    loop.quit()