From b66b7f974e7ec04bb80a2ca2fc859f5b13b9434a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Manuel=20Garc=C3=ADa?= Date: Thu, 30 Jan 2014 03:27:28 -0200 Subject: [PATCH] Update README.md --- README.md | 117 +++++++++++++++--------------------------------------- 1 file changed, 31 insertions(+), 86 deletions(-) diff --git a/README.md b/README.md index e66f1f9..b9ca387 100644 --- a/README.md +++ b/README.md @@ -16,92 +16,6 @@ provides objects instead of json dictionaries! ------------------------------------------------------------------- -Here's a little example to access your facebook profile data - - -```python - -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) - -#Gets info about myself -me = pyfb.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 - -print -print "Worked at:" -for work in me.work: - print "- %s" % work.employer.name - -print "-" * 40 - -``` - -### Facebook paginated lists (Included in version 0.4.0) - -```python - -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 "next" method to get the next page of photos! -more_photos = photos.next() - -print "\nMore photos:\n" -for photo in more_photos: - print photo.picture - -more_more_photos = more_photos.next() - -print "\nDo you want more?:\n" -for photo in more_more_photos: - print photo.picture - -``` ## Django Facebook Integration Using Pyfb @@ -302,3 +216,34 @@ urlpatterns = patterns('', (r'^facebook_javascript_login_sucess/$', 'djangoapp.django_pyfb.views.facebook_javascript_login_sucess'), ) ``` + +## Facebook paginated lists (Included in version 0.4.0) + +```python + +from pyfb import Pyfb + +(...) +# Do the oauth authentication (see the django example above) +(...) + +photos = pyfb.get_photos() + +print "These are my photos:\n" +for photo in photos: + print photo.picture + +#Just call the "next" method to get the next page of photos! +more_photos = photos.next() + +print "\nMore photos:\n" +for photo in more_photos: + print photo.picture + +more_more_photos = more_photos.next() + +print "\nDo you want more?:\n" +for photo in more_more_photos: + print photo.picture + +```