comdev/facebook_api.py
def get_page_api(client_access_token, page_id):
    """
    You can also skip the above if you get a page token:
    http://stackoverflow.com/questions/8231877
    and make that long-lived token as in Step 3
    """
    graph = GraphAPI(client_access_token)
    # Get page token to post as the page. You can skip
    # the following if you want to post as yourself.
    resp = graph.get('me/accounts')
    page_access_token = None

    for page in resp['data']:
        if page['id'] == page_id:
            page_access_token = page['access_token']
            break

    return GraphAPI(page_access_token)
def get_page_api(client_access_token, page_id):
    """
    You can also skip the above if you get a page token:
    http://stackoverflow.com/questions/8231877
    and make that long-lived token as in Step 3
    """
    graph = GraphAPI(client_access_token)
    # Get page token to post as the page. You can skip
    # the following if you want to post as yourself.
    resp = graph.get('me/accounts')
    page_access_token = None

    for page in resp['data']:
        if page['id'] == page_id:
            page_access_token = page['access_token']
            break

    return GraphAPI(page_access_token)
def get_page_api ( client_access_token , page_id ) : graph = GraphAPI ( client_access_token ) # Get page token to post as the page. You can skip # the following if you want to post as yourself. resp = graph . get ( 'me/accounts' ) page_access_token = None for page in resp [ 'data' ] : if page [ 'id' ] == page_id : page_access_token = page [ 'access_token' ] break return GraphAPI ( page_access_token )
You can also skip the above if you get a page token:
    http://stackoverflow.com/questions/8231877
    and make that long-lived token as in Step 3
You can also skip the above if you get a page token : http : // stackoverflow . com / questions / 8231877 and make that long - lived token as in Step 3