comdev/facebook_api.py
def get_token(client_id, client_secret, client_access_token, page=None):
    """
    See: http://nodotcom.org/python-facebook-tutorial.html
    """
    payload = {
        'grant_type': 'client_credentials',
        'client_id': client_id,
        'client_secret': client_secret,
    }

    if client_access_token:
        payload['grant_type'] = 'fb_exchange_token'
        payload['fb_exchange_token'] = client_access_token

    # response {"access_token":" ... ", "token_type":"bearer", "expires_in":..}
    response = requests.post(
        'https://graph.facebook.com/oauth/access_token?',
        params=payload)
    access_token = response.json()['access_token']
    return access_token
def get_token(client_id, client_secret, client_access_token, page=None):
    """
    See: http://nodotcom.org/python-facebook-tutorial.html
    """
    payload = {
        'grant_type': 'client_credentials',
        'client_id': client_id,
        'client_secret': client_secret,
    }

    if client_access_token:
        payload['grant_type'] = 'fb_exchange_token'
        payload['fb_exchange_token'] = client_access_token

    # response {"access_token":" ... ", "token_type":"bearer", "expires_in":..}
    response = requests.post(
        'https://graph.facebook.com/oauth/access_token?',
        params=payload)
    access_token = response.json()['access_token']
    return access_token
See: http://nodotcom.org/python-facebook-tutorial.html