コード例 #1
0
ファイル: fb_login.py プロジェクト: dannysaban/BRUWZ
    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 '''    
コード例 #2
0
ファイル: basics.py プロジェクト: pepeleproso/pyfb
#!/usr/bin/env python
from pyfb import Pyfb

#Your APP ID. It Needs to register your application on facebook
#http://developers.facebook.com/
FACEBOOK_APP_ID = '178358228892649'

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
token = raw_input("Enter the access_token\n")

#Sets the authentication token
facebook.set_access_token(token)

#Gets info about myself
me = facebook.get_myself()

print "-" * 40
print "Name: %s" % me.name
print "From: %s" % me.hometown.name
print

print "Speaks:"
for language in me.languages:
    print "- %s" % language.name
コード例 #3
0
ファイル: allPythonContent.py プロジェクト: Mondego/pyreco
__FILENAME__ = basics
#!/usr/bin/env python
from pyfb import Pyfb

#Your APP ID. It Needs to register your application on facebook
#http://developers.facebook.com/
FACEBOOK_APP_ID = '178358228892649'

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
token = raw_input("Enter the access_token\n")

#Sets the authentication token
facebook.set_access_token(token)

#Gets info about myself
me = facebook.get_myself()

print "-" * 40
print "Name: %s" % me.name
print "From: %s" % me.hometown.name
print

print "Speaks:"
for language in me.languages:
    print "- %s" % language.name
コード例 #4
0
ファイル: basics.py プロジェクト: stevenylai/tornado_pyfb
#!/usr/bin/env python
from pyfb import Pyfb

#Your APP ID. It Needs to register your application on facebook
#http://developers.facebook.com/
FACEBOOK_APP_ID = '178358228892649'

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
token = raw_input("Enter the access_token\n")

#Sets the authentication token
facebook.set_access_token(token)

#Gets info about myself
me = facebook.get_myself()

print "-" * 40
print "Name: %s" % me.name
print "From: %s" % me.hometown.name
print

print "Speaks:"
for language in me.languages:
    print "- %s" % language.name
コード例 #5
0
from pyfb import Pyfb

#Your APP ID. You Need to register the application on facebook
#http://developers.facebook.com/
FACEBOOK_APP_ID = 'YOUR_APP_ID'

pyfb = 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
pyfb.authenticate()

#Copy the [access_token] and enter it below
token = raw_input("Enter the access_token\n")

#Sets the authentication token
pyfb.set_access_token(token)

photos = pyfb.get_photos()

print "These are my photos:\n"
for photo in photos:
    print photo.picture

#Just call the method next to get the next page of photos!
more_photos = photos.next()

print "\nMore photos:\n"
for photo in more_photos:
    print photo.picture
コード例 #6
0
__FILENAME__ = basics
#!/usr/bin/env python
from pyfb import Pyfb

#Your APP ID. It Needs to register your application on facebook
#http://developers.facebook.com/
FACEBOOK_APP_ID = '178358228892649'

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
token = raw_input("Enter the access_token\n")

#Sets the authentication token
facebook.set_access_token(token)

#Gets info about myself
me = facebook.get_myself()

print "-" * 40
print "Name: %s" % me.name
print "From: %s" % me.hometown.name
print

print "Speaks:"
for language in me.languages:
    print "- %s" % language.name