def getKey(): url = 'http://localhost:5000' consumer_key = 'AkahU7LuENNRNz4YEU1t0gYf' consumer_secret = 'zgyp6JxNMDWH0uqgdet8MQy4qb3UZh7S6dDsEnwX' aweber = AWeberAPI(consumer_key, consumer_secret) request_token, request_token_secret = aweber.get_request_token(url + '/callback') print request_token print request_token_secret print aweber.authorize_url redirect(authorization_url) aweber.user.verifier = verifier aweber.user.request_token = request_token aweber.user.token_secret = request_token_secret access_token, access_token_secret = aweber.get_access_token() print access_token
from aweber_api import AWeberAPI # replace XXX with your keys consumer_key = 'Ak7W3K2vE3pODdOyag0t5X79' consumer_secret = 'ekxdnHs8aPgHIlI6RBLk3BynpylWEHCzSr4042vP' # create new instance of AWeberAPI application = AWeberAPI(consumer_key, consumer_secret) # get a request token request_token, token_secret = application.get_request_token('oob') # prompt user to go to the auth url print 'Go to this url in your browser: %s' % application.authorize_url # prompt for verifier code code = raw_input('Type code here: ') # exchange request token + verifier code for access token application.user.request_token = request_token application.user.token_secret = token_secret application.user.verifier = code access_token, access_secret = application.get_access_token() # show the results print access_token, access_secret
application = AWeberAPI(consumer_key, consumer_secret) # get a request token request_token, token_secret = application.get_request_token('oob') # pylint: disable=E1601 print 'Go to this url in your browser: %s' % application.authorize_url # prompt for verifier code code = raw_input('Type code here: ') # exchange request token + verifier code for access token application.user.request_token = request_token application.user.token_secret = token_secret application.user.verifier = code access_key, access_secret = application.get_access_token() members_list_id = os.environ['MEMBERS_LIST_ID'] prospects_list_id = os.environ['PROSPECTS_LIST_ID'] data = json.load(open('members-and-prospects.json')) aweber = AWeberAPI(consumer_key, consumer_secret) account = aweber.get_account(access_key, access_secret) for member in data['members']: try: print 'Member: %s' % member['personal']['email'] list_url = '/accounts/%s/lists/%s' % (account.id, members_list_id) list_ = account.load_from_url(list_url)