本文整理汇总了Python中open_facebook.api.FacebookAuthorization.create_test_user方法的典型用法代码示例。如果您正苦于以下问题:Python FacebookAuthorization.create_test_user方法的具体用法?Python FacebookAuthorization.create_test_user怎么用?Python FacebookAuthorization.create_test_user使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类open_facebook.api.FacebookAuthorization
的用法示例。
在下文中一共展示了FacebookAuthorization.create_test_user方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_users
# 需要导入模块: from open_facebook.api import FacebookAuthorization [as 别名]
# 或者: from open_facebook.api.FacebookAuthorization import create_test_user [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)