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


Python pyfb.Pyfb类代码示例

本文整理汇总了Python中pyfb.Pyfb的典型用法代码示例。如果您正苦于以下问题:Python Pyfb类的具体用法?Python Pyfb怎么用?Python Pyfb使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: facebook_login_success

def facebook_login_success(request):
    code = request.GET.get('code')
    facebook = Pyfb(FACEBOOK_APP_ID)
    request.session['tokenFB'] = facebook.get_access_token(FACEBOOK_SECRET_KEY, code,
                                                           redirect_uri=FACEBOOK_REDIRECT_URL)
    user_process(request.session.get('tokenFB'))
    return HttpResponseRedirect(reverse('main.views.manage'))
开发者ID:Diego999,项目名称:Social-Recommendation-System,代码行数:7,代码来源:views.py

示例2: facebook_login_success

def facebook_login_success(request):
    code = request.GET.get('code')
    facebook = Pyfb(FACEBOOK_APP_ID)
    access_token = facebook.get_access_token(FACEBOOK_SECRET_KEY, code, redirect_uri=FACEBOOK_REDIRECT_URL)
    facebook.set_access_token(access_token)
    request.session['access_token'] = access_token
    return render_user(facebook, request)
开发者ID:vongochung,项目名称:mytutorial,代码行数:7,代码来源:views.py

示例3: facebook_javascript_login_sucess

def facebook_javascript_login_sucess(request):
    access_token = request.GET.get("access_token")

    facebook = Pyfb(FACEBOOK_APP_ID)
    facebook.set_access_token(access_token)

    return _render_user(facebook)
开发者ID:andreimariusdincu,项目名称:eestec_hackathon,代码行数:7,代码来源:views.py

示例4: PyfbTests

class PyfbTests(unittest.TestCase):

    pyfb_args = {}

    def setUp(self):
        self.pyfb = Pyfb(config["FACEBOOK_APP_ID"], **self.pyfb_args)
        self.pyfb.set_access_token(config["FACEBOOK_TOKEN"])
        self.me = self.pyfb.get_myself()

    def test_auth(self):
        self.assertEquals(type(self.me.name), type(unicode()))

    def test_get_friends(self):
        self.assertTrue(isinstance(self.pyfb.get_friends(self.me.id), list))

    def test_get_photos_paging(self):    	
        photos = self.pyfb.get_photos()
        more_photos = photos.next()
        more_more_photos = more_photos.next()

        if len(photos) < 25 and len(more_photos) > 0:
        	raise Exception()
        
        if len(photos) == 25 and len(more_photos) < 25 and len(more_more_photos) > 0:
        	raise Exception()

        self.assertTrue(isinstance(photos, list))
        self.assertTrue(isinstance(more_photos, list))
        self.assertTrue(isinstance(more_more_photos, list))

        self.assertEquals(len(photos), len(more_photos.previous()))
        self.assertEquals(photos.previous(), [])
开发者ID:atul2512,项目名称:pyfb,代码行数:32,代码来源:test.py

示例5: setpassword

def setpassword(request, idnum):

    idnum = int(idnum)

    try:
        fb = FacebookProfiles.objects.get(fbk_id = idnum)
        facebook = Pyfb(settings.FACEBOOK_APP_ID)
        facebook.set_access_token(fb.fbk_token)
        me = facebook.get_user_by_id(id = fb.fbk_id)
        user = fb.user
    except ObjectDoesNotExist:
        return HttpResponseRedirect('/')

    if request.method == 'POST':
        form = PasswordSetForm(request.POST)

        if form.is_valid():
            user.set_password(form.cleaned_data['password'])
            user.save()
            authuser = authenticate(username=user.username, password=form.cleaned_data['password'])
            if authuser is not None:
                login(request, authuser)
            return HttpResponseRedirect('/auth/welcome/')
    else:
        form = PasswordSetForm()

    var = RequestContext(request, {
        'form':form,
        'me':me,
        'user':user
        })

    return render_to_response('registration/facebook.html', var)
开发者ID:mnive93,项目名称:ratatat,代码行数:33,代码来源:views.py

示例6: facebook_login_success

def facebook_login_success(request):
    code = request.GET.get('code')    
    facebook = Pyfb(FACEBOOK_APP_ID)
    facebook.get_access_token(FACEBOOK_APP_SECRET, code, redirect_uri=FACEBOOK_REDIRECT_URL)
    me = facebook.get_myself()

    welcome = "Welcome %s. Your Facebook login has been completed successfully! Is this your email address? %s"
    return HttpResponse(welcome % (me.name, me.email))
开发者ID:mnive93,项目名称:django-facebookconnect,代码行数:8,代码来源:views.py

示例7: facebook_login_success

def facebook_login_success(request):

    code = request.GET.get('code')

    facebook = Pyfb(FACEBOOK_APP_ID)
    facebook.get_access_token(FACEBOOK_SECRET_KEY, code, redirect_uri=FACEBOOK_REDIRECT_URL)

    return _render_user(facebook)
开发者ID:Mondego,项目名称:pyreco,代码行数:8,代码来源:allPythonContent.py

示例8: facebook_login_success

def facebook_login_success(request):
    
    code = request.GET.get('code')    

    facebook = Pyfb(FACEBOOK_APP_ID)
    facebook.get_access_token(FACEBOOK_SECRET_KEY, code, redirect_uri=FACEBOOK_REDIRECT_URL)
    me = facebook.get_myself()
    
    welcome = "Welcome <b>%s</b>. Your Facebook login has been completed successfully!"
    return HttpResponse(welcome % me.name)
开发者ID:holm,项目名称:pyfb,代码行数:10,代码来源:views.py

示例9: facebook_login

def facebook_login(request):
    # Gets the auth redirect url with code provided from facebook.
    facebook = Pyfb(
        settings.CLIENT_ID,
        permissions=settings.FACEBOOK_SCOPE
    )
    auth_code_url = facebook.get_auth_code_url(
        redirect_uri=settings.REDIRECT_URL
    )
    return HttpResponseRedirect(auth_code_url)
开发者ID:gitter-badger,项目名称:faceguard,代码行数:10,代码来源:views.py

示例10: facebook_login

def facebook_login(request):
    facebook = Pyfb(settings.CLIENT_ID, permissions=[
        'publish_actions',
        'publish_pages',
        'user_photos',
        'user_posts',
        'manage_pages',
        'user_about_me',
        'email'
    ])
    auth_code_url = facebook.get_auth_code_url(redirect_uri=settings.REDIRECT_URL)
    return HttpResponseRedirect(auth_code_url)
开发者ID:lhamu,项目名称:faceguard,代码行数:12,代码来源:views.py

示例11: FacebookLoginSuccess

def FacebookLoginSuccess (request):
	code = request.GET.get('code')

	facebook = Pyfb(FACEBOOK_APP_ID)
	facebook.get_access_token(FACEBOOK_SECRET_KEY, code, redirect_uri=FACEBOOK_REDIRECT_URL)
	me = facebook.get_myself()

	if (type(me.name) == type(unicode())):
		return HttpResponse('It worked')

	welcome = "Welcome <b>%s</b>. Your Facebook login has been completed successfully!"
	return HttpResponse(welcome % me.username)
开发者ID:KineticHub,项目名称:DrinkUp-Server,代码行数:12,代码来源:views.py

示例12: pyfbTests

class pyfbTests(unittest.TestCase):

    def setUp(self):
        self.facebook = Pyfb(FACEBOOK_APP_ID)
        self.facebook.set_access_token(FACEBOOK_TOKEN)
        self.me = self.facebook.get_myself()

    def test_auth(self):
        self.assertEquals(type(self.me.name), type(unicode()))

    def test_get_friends(self):
        self.assertEquals(type(self.facebook.get_friends(self.me.id)), type(list()))
开发者ID:evandekieft,项目名称:pyfb,代码行数:12,代码来源:test.py

示例13: save

    def save(self, access_token, request):

        pyfb = Pyfb(FACEBOOK_CONFIG["id"], access_token=access_token)
        me = pyfb.get_myself()

        user, created = User.objects.get_or_create(username=me.name, email=me.email)

        if created:
            user.save()
            player = self.new(remote_id=me.id, user=user)
            player.save()

        self.login(user, request)
        return user
开发者ID:DeathBorn,项目名称:scrabbly-cloud,代码行数:14,代码来源:facebook.py

示例14: facebook_login_success

def facebook_login_success(request):
    code = request.GET.get('code')    
    facebook = Pyfb(settings.FACEBOOK_APP_ID)
    facebook.get_access_token(settings.FACEBOOK_SECRET_KEY, code, redirect_uri=settings.FACEBOOK_REDIRECT_URL)
    me = facebook.get_myself()

    try:
        email = InviteEmails.objects.get(emailaddress = me.email)
    except ObjectDoesNotExist:
        emailInstanceCreate(me.email)
        email = InviteEmails.objects.get(emailaddress = me.email)

        return render_to_response('invites/result.html', RequestContext(request, {'email':email, 'result':'success'}))
    return render_to_response('invites/result.html', RequestContext(request, {'email':email, 'result':'existing'}))
开发者ID:mnive93,项目名称:lw-1,代码行数:14,代码来源:views.py

示例15: login_facebook

def login_facebook(request):
    if 'access_token' not in request.GET:
        return Response(ReturnObject(RetCode._FAIL, _('Access token not exist in request'), None).to_json())

    try:
        access_token = request.GET.get('access_token')
        facebook = Pyfb(FACEBOOK_APP_ID)
        facebook.set_access_token(access_token)
        result = _render_user(facebook, request)
        if result != '':
            return Response(ReturnObject(RetCode._FAIL, result, None).to_json())
        else:
            current_player = get_current_user(request)
            return Response(ReturnObject(RetCode._SUCCESS, _('Login successfully'), current_player).to_json())
    except Exception, error:
        return Response(ReturnObject(RetCode._SYSTEM_ERROR, _('System error, access token is wrong'), None).to_json())
开发者ID:vongochung,项目名称:mytutorial,代码行数:16,代码来源:views.py


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