當前位置: 首頁>>代碼示例>>Python>>正文


Python Pyfb.fql_query方法代碼示例

本文整理匯總了Python中pyfb.Pyfb.fql_query方法的典型用法代碼示例。如果您正苦於以下問題:Python Pyfb.fql_query方法的具體用法?Python Pyfb.fql_query怎麽用?Python Pyfb.fql_query使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pyfb.Pyfb的用法示例。


在下文中一共展示了Pyfb.fql_query方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: get

# 需要導入模塊: from pyfb import Pyfb [as 別名]
# 或者: from pyfb.Pyfb import fql_query [as 別名]
    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,代碼行數:59,代碼來源:fb_login.py


注:本文中的pyfb.Pyfb.fql_query方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。