Пример #1
0
from fireeagle_api import FireEagle
fe = FireEagle( "MLxYXHDkLiA8", "r9qanNnpBvFX3mF3xmI98Hsjsg3zJ389" ) # dev
application_token = fe.request_token()
auth_url          = fe.authorize( application_token )
print auth_url
pause( 'Please authorize the app at that URL!' )
user_token        = fe.access_token( application_token )
print fe.lookup( user_token, q='London, England' )
print fe.user( user_token )
Пример #2
0
    exit()

def pause( prompt='hit to continue' ):
    return raw_input( '\n' + prompt + '\n' )

fe = FireEagle( settings.CONSUMER_KEY, settings.CONSUMER_SECRET )

# Load the access token
token_file = open( settings.AUTH_FILE, 'r' )
try:
    access_token = pickle.load( token_file )
finally:
    token_file.close()

# Disambiguate the input to a place_id that Fire Eagle can understand
lookup_results = fe.lookup( access_token, q=argv[1] )

# If we have multiple locations, get the user to confirm. Otherwise, go ahead.
if 1 < len(lookup_results):
    for i, location in enumerate( lookup_results ):
        print '%(#)d: %(name)s' % { '#': i, 'name': location['name'] }
    
    chosen_location = pause( "Pick the correct location:" )
    update_location = lookup_results[int( chosen_location )]
elif 1 == len(lookup_results):
    update_location = lookup_results[0]
else:
    print "Fire Eagle couldn't find anywhere matching that string, sorry."
    exit()

# Perform the update
Пример #3
0
def pause(prompt='hit to continue'):
    return raw_input('\n' + prompt + '\n')


fe = FireEagle(settings.CONSUMER_KEY, settings.CONSUMER_SECRET)

# Load the access token
token_file = open(settings.AUTH_FILE, 'r')
try:
    access_token = pickle.load(token_file)
finally:
    token_file.close()

# Disambiguate the input to a place_id that Fire Eagle can understand
lookup_results = fe.lookup(access_token, q=argv[1])

# If we have multiple locations, get the user to confirm. Otherwise, go ahead.
if 1 < len(lookup_results):
    for i, location in enumerate(lookup_results):
        print '%(#)d: %(name)s' % {'#': i, 'name': location['name']}

    chosen_location = pause("Pick the correct location:")
    update_location = lookup_results[int(chosen_location)]
elif 1 == len(lookup_results):
    update_location = lookup_results[0]
else:
    print "Fire Eagle couldn't find anywhere matching that string, sorry."
    exit()

# Perform the update