Example #1
0
def facebook_javascript_login_success(request):
    access_token = request.GET.get("access_token")
    facebook = Pyfb(FACEBOOK_APP_ID)
    facebook.set_access_token(access_token)
    return render_user(facebook)
Example #2
0
 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()
Example #3
0
def facebook_login(request):
    if "access_token" not in request.session:
        facebook = Pyfb(FACEBOOK_APP_ID)
        return HttpResponseRedirect(facebook.get_auth_code_url(redirect_uri=FACEBOOK_REDIRECT_URL))
    return redirect('/account/dashboard')
Example #4
0
#!/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
Example #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
Example #6
0
def facebook_login(request):

    facebook = Pyfb(FACEBOOK_APP_ID)
    return HttpResponseRedirect(
        facebook.get_auth_code_url(redirect_uri=FACEBOOK_REDIRECT_URL))
Example #7
0
 def setUp(self):
     self.facebook = Pyfb(FACEBOOK_APP_ID)
     self.facebook.set_access_token(FACEBOOK_TOKEN)
     self.me = self.facebook.get_myself()