當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。