本文整理汇总了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))
示例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)