• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python pyfb.Pyfb类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: facebooksignupsuccess

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

    try:
        user = User.objects.get(email = me.email)
        try:
            fbk = FacebookProfiles.objects.get(user = user)
        except ObjectDoesNotExist:
            fbk = FacebookProfiles.objects.create(
                user = user,
                fbk_id = me.id,
                fbk_token = fb_token
            )

        return HttpResponseRedirect('/auth/login/')
    except ObjectDoesNotExist:
        user = User.objects.create_user(
            username = me.username,
            email = me.email
            )

        fbk = FacebookProfiles.objects.create(
            user = user,
            fbk_id = me.id,
            fbk_token = fb_token
        )

        name_split = shlex.split(me.name)
        fname = name_split[0]
        lname = ''
    
        for x in name_split[1:]:
            lname += (x + ' ')

        user.first_name = fname
        user.last_name = lname
            
        user.save()

        return HttpResponseRedirect('/auth/setpwd/%s' % str(me.id))
开发者ID:mnive93,项目名称:ratatat,代码行数:43,代码来源:views.py


示例17: get

    def get(self, user_token):
        #return {User_data: User[token]}
        
        FACEBOOK_APP_ID = '134416106741047'

        facebook = Pyfb(FACEBOOK_APP_ID)

        #Opens a new browser tab instance and authenticates with the facebook API
        #It redirects to an url like http://www.facebook.com/connect/login_success.html#access_token=[access_token]&expires_in=0
        facebook.authenticate()

        #Copy the [access_token] and enter it below
        getToken = user_token#'CAACEdEose0cBACIgotCQGDecYsWW1O7wrc5saw0ZCxrM8nKzF3wWgIvQqGyb9H5u3MIBKak9jcYc3l1CNZCdYniVI3tweTC8vX2PdibMlJrdrH1LIeJnmgWQS8WpkXyRzY8dpvGgFDZARq2amdAZBEXEXJePKSuMqTIOXCCfQMzNd3QMtldxD25lkFg3IANRVfjviSo6uQZDZD'

        #Sets the authentication token
        facebook.set_access_token(getToken)

        #Gets info about myself
        me = facebook.get_myself()
        me_pic = facebook.fql_query('SELECT pic_small FROM user WHERE uid = me()')
        #friends = facebook.get_friends()

        me_name = me.name
        me_id = me.id
        me_gender = me.gender
        location = getattr(me, "location")
        me_location = location.name

        for i in me_pic:
            try:
                my_pic = i.pic_small
            except AttributeError:
                my_pic = 'None'
            try:
                me_birthday = me.birthday
            except AttributeError:
                me_birthday = 'None'

            try:
                me_status = me.relationship_status   
            except AttributeError:
                me_status = 'None'

            try:
                me_link = me.link
            except AttributeError:
                me_link = 'None'
    
    
        me_all = {'name': me_name, 'id': me_id, 'gender': me_gender, 'location': me_location, 'birthday': me_birthday, 'status': me_status, 'link': me_link, 'picture': my_pic  }    
        #db.dannysaban.insert(me_all)
        #print 'me - done!'
        #get_me = db.dannysaban.find({'id': me_id})
        return me_all   
    

        ''' update user data '''    
开发者ID:dannysaban,项目名称:BRUWZ,代码行数:57,代码来源:fb_login.py


示例18: facebook_login_success

def facebook_login_success(request):
    code = request.GET.get('code')
    facebook = Pyfb(settings.FACEBOOK_APP_ID)
    access_token = facebook.get_access_token(settings.FACEBOOK_SECRET_KEY, code, redirect_uri=settings.FACEBOOK_REDIRECT_URL)
    me = facebook.get_myself()
     
    #welcome = "Welcome <b>%s</b>. Your Facebook login has been completed successfully!"
    #return HttpResponse(welcome % me.name)
    print access_token
    
    try:
        u=user.objects.get(facebookid=me.id)
        #update access_token
        u.access_token = access_token
        u.save()
    except user.DoesNotExist:
        uhash = make_uuid()
        u = user.objects.create(uhash=uhash, name=me.name,facebookid = me.id, email=me.email, access_token=access_token)

    return render_to_response('mymovies/facebook_login_success.html',{'name':me.name,'uhash':uhash},context_instance=RequestContext(request))
开发者ID:zixuanwang,项目名称:Research,代码行数:20,代码来源:views.py


示例19: login

def login(request):
    from datetime import datetime 
    from pyfb import Pyfb
    from NossaCarona.settings import FACEBOOK_APP_ID, FACEBOOK_SECRET_KEY, FACEBOOK_REDIRECT_URL_LOGIN
    if request.GET.get('code'): #Login WITH facebook
        code =  request.GET['code']
        facebook = Pyfb(FACEBOOK_APP_ID)
        facebook.get_access_token(FACEBOOK_SECRET_KEY, code, redirect_uri=FACEBOOK_REDIRECT_URL_LOGIN)
        me = facebook.get_myself()
        userdjango = authenticate(fb_id=me.id)
        if not userdjango:
            userdjango = DjangoUser.objects.create_user(me.email, me.email, None)
            userdjango.first_name = me.first_name
            userdjango.last_name = me.last_name
            userdjango.save()
            usuario = Usuario(user=userdjango, sexo=me.gender[0], fb_id=me.id, dt_nascimento=datetime.strptime(me.birthday,'%m/%d/%Y'))
            usuario.save()
        userlogin(request,userdjango)
    else: #login WITHOUT facebook
        pass
    return HttpResponseRedirect('/')
开发者ID:lucasfrp,项目名称:NossaCarona,代码行数:21,代码来源:views.py


示例20: facebook_login_success

def facebook_login_success(request):
    code = request.GET.get('code')
    facebook = Pyfb(settings.CLIENT_ID)
    access_token = facebook.get_access_token(
        settings.CLIENT_APP_SECRET,
        code,
        redirect_uri=settings.REDIRECT_URL
    )
    me = facebook.get_myself()

    try:
        fb_user = FacebookUser.objects.get(email_address=me.email)
        fb_user.access_token = access_token
        fb_user.save()
        user = fb_user.user
    except FacebookUser.DoesNotExist:
        user = User.objects.create(
            username=me.email,
            first_name=me.first_name,
            last_name=me.last_name,
            email=me.email
        )
        user.set_password(me.email)
        user.save()
        fb_user = FacebookUser.objects.create(
            first_name=me.first_name,
            last_name=me.last_name,
            access_token=access_token,
            email_address=me.email,
            username=me.email,
            user=user,
        )

    user = authenticate(
        username=me.email,
        password=me.email
    )
    # log the user in
    login(request, user)
    return HttpResponseRedirect(reverse('blacklist_words'))
开发者ID:gitter-badger,项目名称:faceguard,代码行数:40,代码来源:views.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python log.debug函数代码示例发布时间:2022-05-25
下一篇:
Python utils.open_file_write函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap