当前位置: 首页>>代码示例>>Python>>正文


Python FacebookAuthorization.get_app_access_token方法代码示例

本文整理汇总了Python中open_facebook.api.FacebookAuthorization.get_app_access_token方法的典型用法代码示例。如果您正苦于以下问题:Python FacebookAuthorization.get_app_access_token方法的具体用法?Python FacebookAuthorization.get_app_access_token怎么用?Python FacebookAuthorization.get_app_access_token使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在open_facebook.api.FacebookAuthorization的用法示例。


在下文中一共展示了FacebookAuthorization.get_app_access_token方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setupFBUpdates

# 需要导入模块: from open_facebook.api import FacebookAuthorization [as 别名]
# 或者: from open_facebook.api.FacebookAuthorization import get_app_access_token [as 别名]
def setupFBUpdates(request):
    graph = get_facebook_graph(request)
    #get app's access token
    access_token = FacebookAuthorization.get_app_access_token()    
    params = {'access_token': access_token}
    postdata = {'object': 'user', 'fields': "friends,music,books,movies,tv,likes", 'callback_url':"http://www.popcore.me/realtime/receive_fb_updates", 'verify_token':VERIFY_TOKEN }
    url = '%s%s?%s' % ("https://graph.facebook.com/", FACEBOOK_APP_ID + "/subscriptions", urllib.urlencode(params))
    res= graph._request(url, post_data=postdata)
    #now check the new update configuration
   
    #import pprint
    response = graph._request(url)
    return HttpResponse(pprint.pformat(response))
开发者ID:amit-sharma,项目名称:popcore,代码行数:15,代码来源:realtime.py

示例2: test_users

# 需要导入模块: from open_facebook.api import FacebookAuthorization [as 别名]
# 或者: from open_facebook.api.FacebookAuthorization import get_app_access_token [as 别名]
def test_users(request):
    '''
    Create test users for facebook
    '''
    if not request.user.is_staff:
        raise Http404("access denied")
    context = RequestContext(request)

    if request.POST:
        from open_facebook.api import FacebookAuthorization
        token = FacebookAuthorization.get_app_access_token()

        fb_response = ''
        if request.POST.get('create_user', None):
            name = request.POST.get('user_name', None)
            app_access = request.POST.get('app_access', None)
            if app_access == 'on':
                app_access = True
            else:
                app_access = False
            fb_response = FacebookAuthorization.create_test_user(token, name=name, app_access=app_access)

        if request.POST.get('get_users', None):
            fb_response = FacebookAuthorization.get_test_users(token)

            test_users = []
            if len(fb_response) > 0:
                test_users = fb_response

            context['test_users'] = test_users
            # test_users = FacebookTestUser.objects.filter(app_access_token=token)

        if request.POST.get('delete_user', None):
            user_id = request.POST.get('delete_user_id', None)
            fb_response = FacebookAuthorization.delete_test_user(token, user_id)

        context['fb_response'] = fb_response

    return render_to_response('django_facebook/test_users.html', context)
开发者ID:zene,项目名称:Django-facebook,代码行数:41,代码来源:views.py


注:本文中的open_facebook.api.FacebookAuthorization.get_app_access_token方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。