Ejemplo n.º 1
0
    def connect_to_AWeber_account(self):
        app_id = '98a30a69'
        authorization_url = 'https://auth.aweber.com/1.0/oauth/authorize_app/%s' % app_id
        print 'Go to this url in your browser: %s' % authorization_url
        authorization_code = raw_input('Type code here: ')

        auth = AWeberAPI.parse_authorization_code(authorization_code)
        consumer_key, consumer_secret, access_key, access_secret = auth
        print auth
        return auth
Ejemplo n.º 2
0
    def connect_to_AWeber_account(self):
        app_id = '7XXXXXX8'
        authorization_url = 'https://auth.aweber.com/1.0/oauth/authorize_app/%s' % app_id
        print 'Go to this url in your browser: %s' % authorization_url
        authorization_code = raw_input('Type code here: ')

        auth = AWeberAPI.parse_authorization_code(authorization_code)
        consumer_key, consumer_secret, access_key, access_secret = auth
        print auth
        return auth
Ejemplo n.º 3
0
def parse_auth_code(widgets):
    """Parse authorization code.

    :param widgets: object to read data from it
    :type widgets: Widgets object
    """
    authorization_code = widgets['authorization_code'].value

    auth = AWeberAPI.parse_authorization_code(
        authorization_code
    )

    c_key, c_secret, a_token, a_secret = auth

    api.portal.set_registry_record(
        'niteoweb.aweber.interfaces.IAweberSettings.consumer_key',
        c_key,
    )
    api.portal.set_registry_record(
        'niteoweb.aweber.interfaces.IAweberSettings.consumer_secret',
        c_secret,
    )
    api.portal.set_registry_record(
        'niteoweb.aweber.interfaces.IAweberSettings.access_token',
        unicode(a_token),
    )
    api.portal.set_registry_record(
        'niteoweb.aweber.interfaces.IAweberSettings.access_secret',
        unicode(a_secret),
    )

    # once parsed there is no need for authorization code any more
    api.portal.set_registry_record(
        'niteoweb.aweber.interfaces.IAweberSettings.authorization_code',
        u"",
    )
Ejemplo n.º 4
0
from aweber_api import AWeberAPI

# replace XXX with your app ID
app_id = '98a30a69'

# prompt user to go to authorization url
authorization_url = 'https://auth.aweber.com/1.0/oauth/authorize_app/%s' % app_id
print 'Go to this url in your browser: %s' % authorization_url

# prompt for authorization code
authorization_code = raw_input('Type code here: ')

# exchange authorization code for new consumer and access keys and secrets
auth = AWeberAPI.parse_authorization_code(authorization_code)
consumer_key, consumer_secret, access_key, access_secret = auth

# print results
print auth