Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
jmg committed Jan 30, 2014
1 parent 3cd225d commit b66b7f9
Showing 1 changed file with 31 additions and 86 deletions.
117 changes: 31 additions & 86 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

```

0 comments on commit b66b7f9

Please sign in to comment.