skip to navigation
skip to content

Not Logged In

django-facebook-pages 0.4.0

Django implementation for Facebook Graph API Pages

# Django Facebook Graph API Ads

[![Build Status]] [![Coverage Status]]

Application for interacting with Facebook Graph API Pages objects using Django model interface

## Installation

pip install django-facebook-pages

Add into `` lines:


# oauth-tokens settings
OAUTH_TOKENS_HISTORY = True # to keep in DB expired access tokens
OAUTH_TOKENS_FACEBOOK_CLIENT_SECRET = '' # application secret key
OAUTH_TOKENS_FACEBOOK_SCOPE = ['offline_access'] # application scopes

## Usage examples

### Fetch page by Graph ID

>>> from facebook_pages.models import Page
>>> page = Page.remote.fetch('19292868552')
>>> page
<page: facebook="" developers="">
>>> page.__dict__
{'_external_links_post_save': [],
'_external_links_to_add': [],
'_foreignkeys_post_save': [],
'_state': <django.db.models.base.modelstate at="" 0xb1d718c="">,
'about': 'Grow your app with Facebook\n ',
'can_post': False,
'category': 'Product/service',
'checkins': None,
'company_overview': 'Facebook Platform enables anyone to build social apps on Facebook, mobile, and the web.\n\n',
'cover': {'cover_id': '10151298218353553',
'offset_x': 0,
'offset_y': 0,
'source': ''},
'description': '',
'graph_id': '19292868552',
'id': 9,
'is_published': True,
'likes': 1225086,
'link': ''
'location': None,
'name': 'Facebook Developers',
'phone': '',
'picture': '',
'posts_count': 0,
'products': '',
'talking_about_count': 31550,
'username': 'FacebookDevelopers',
'website': ''}

### Fetch and access page posts and comments

For this purpose you need to install dependency
[`django-facebook-posts`] and add it into `INSTALLED_APPS`

>>> from facebook_pages.models import Page
>>> page = Page.remote.fetch('19292868552')
>>> page.fetch_posts()
[<post: facebook="" developers:="" excited="" for="" march="" madness?="" we="" spoke="" with="" the="" folks="" at="" pickmoto="" about="" their="" app="" to="" manage="" march="" madness="" pools.="" check="" out="" the="" interview.="">,
<post: facebook="" developers:="" to="" help="" developers="" understand="" the="" updates="" we="" just="" announced="" to="" timeline="" and="" open="" graph,="" we've="" published="" this="" three="" video="" series.="" check="" it="" out!="">,
'...(remaining elements truncated)...']
>>> page.wall_posts.count()
>>> page.wall_posts[0].fetch_comments()
[<comment: comment="" object="">, <comment: comment="" object="">, <comment: comment="" object="">, '...(remaining elements truncated)...']
>>> page.wall_comments.count()
File Type Py Version Uploaded on Size
django-facebook-pages-0.4.0.tar.gz (md5) Source 2014-12-22 22KB
  • Downloads (All Versions):
  • 43 downloads in the last day
  • 242 downloads in the last week
  • 398 downloads in the last month