Django implementation for Facebook Graph API Users
Project description
# Django Facebook Graph API Users
[![Build Status](https://travis-ci.org/ramusus/django-facebook-users.png?branch=master)](https://travis-ci.org/ramusus/django-facebook-users) [![Coverage Status](https://coveralls.io/repos/ramusus/django-facebook-users/badge.png?branch=master)](https://coveralls.io/r/ramusus/django-facebook-users)
Application for interacting with Facebook Graph API Users objects using Django model interface
## Installation
pip install django-facebook-users
Add into `settings.py` lines:
INSTALLED_APPS = (
...
'oauth_tokens',
'facebook_api',
'facebook_users',
)
# oauth-tokens settings
OAUTH_TOKENS_HISTORY = True # to keep in DB expired access tokens
OAUTH_TOKENS_FACEBOOK_CLIENT_ID = '' # application ID
OAUTH_TOKENS_FACEBOOK_CLIENT_SECRET = '' # application secret key
OAUTH_TOKENS_FACEBOOK_SCOPE = ['offline_access'] # application scopes
OAUTH_TOKENS_FACEBOOK_USERNAME = '' # user login
OAUTH_TOKENS_FACEBOOK_PASSWORD = '' # user password
## Usage examples
### Fetch user by Graph ID
>>> from facebook_users.models import User
>>> user = User.remote.fetch(4)
>>> user
<User: Mark Zuckerberg>
>>> user.__dict__
{'_external_links_post_save': [],
'_external_links_to_add': [],
'_foreignkeys_post_save': [],
'_state': <django.db.models.base.ModelState at 0xdf4514c>,
'bio': '',
'birthday': '',
'cover': {'id': '989690200741',
'offset_y': 0,
'source': 'http://m.ak.fbcdn.net/sphotos-a.ak/hphotos-ak-ash4/s720x720/311205_989690200741_1231438675_n.jpg'},
'currency': None,
'devices': None,
'education': None,
'email': '',
'favorite_athletes': None,
'favorite_teams': None,
'first_name': 'Mark',
'gender': 'male',
'graph_id': '4',
'hometown': None,
'id': 11214,
'installed': None,
'interested_in': None,
'languages': None,
'last_name': 'Zuckerberg',
'link': 'http://www.facebook.com/zuck',
'locale': 'en_US',
'location': None,
'middle_name': '',
'name': 'Mark Zuckerberg',
'payment_pricepoints': None,
'picture': '',
'political': '',
'quotes': '',
'relationship_status': '',
'religion': '',
'security_settings': None,
'significant_other': None,
'third_party_id': '7joA1JrNkjG9e-A6yGLZyiTzdL4',
'timezone': None,
'updated_time': datetime.datetime(2013, 3, 13, 20, 36, 43, tzinfo=tzutc()),
'username': 'zuck',
'verified': False,
'video_upload_limits': None,
'website': '',
'work': None}
### Fetch user by slug
>>> from facebook_users.models import User
>>> User.remote.fetch('zuck')
<User: Mark Zuckerberg>
[![Build Status](https://travis-ci.org/ramusus/django-facebook-users.png?branch=master)](https://travis-ci.org/ramusus/django-facebook-users) [![Coverage Status](https://coveralls.io/repos/ramusus/django-facebook-users/badge.png?branch=master)](https://coveralls.io/r/ramusus/django-facebook-users)
Application for interacting with Facebook Graph API Users objects using Django model interface
## Installation
pip install django-facebook-users
Add into `settings.py` lines:
INSTALLED_APPS = (
...
'oauth_tokens',
'facebook_api',
'facebook_users',
)
# oauth-tokens settings
OAUTH_TOKENS_HISTORY = True # to keep in DB expired access tokens
OAUTH_TOKENS_FACEBOOK_CLIENT_ID = '' # application ID
OAUTH_TOKENS_FACEBOOK_CLIENT_SECRET = '' # application secret key
OAUTH_TOKENS_FACEBOOK_SCOPE = ['offline_access'] # application scopes
OAUTH_TOKENS_FACEBOOK_USERNAME = '' # user login
OAUTH_TOKENS_FACEBOOK_PASSWORD = '' # user password
## Usage examples
### Fetch user by Graph ID
>>> from facebook_users.models import User
>>> user = User.remote.fetch(4)
>>> user
<User: Mark Zuckerberg>
>>> user.__dict__
{'_external_links_post_save': [],
'_external_links_to_add': [],
'_foreignkeys_post_save': [],
'_state': <django.db.models.base.ModelState at 0xdf4514c>,
'bio': '',
'birthday': '',
'cover': {'id': '989690200741',
'offset_y': 0,
'source': 'http://m.ak.fbcdn.net/sphotos-a.ak/hphotos-ak-ash4/s720x720/311205_989690200741_1231438675_n.jpg'},
'currency': None,
'devices': None,
'education': None,
'email': '',
'favorite_athletes': None,
'favorite_teams': None,
'first_name': 'Mark',
'gender': 'male',
'graph_id': '4',
'hometown': None,
'id': 11214,
'installed': None,
'interested_in': None,
'languages': None,
'last_name': 'Zuckerberg',
'link': 'http://www.facebook.com/zuck',
'locale': 'en_US',
'location': None,
'middle_name': '',
'name': 'Mark Zuckerberg',
'payment_pricepoints': None,
'picture': '',
'political': '',
'quotes': '',
'relationship_status': '',
'religion': '',
'security_settings': None,
'significant_other': None,
'third_party_id': '7joA1JrNkjG9e-A6yGLZyiTzdL4',
'timezone': None,
'updated_time': datetime.datetime(2013, 3, 13, 20, 36, 43, tzinfo=tzutc()),
'username': 'zuck',
'verified': False,
'video_upload_limits': None,
'website': '',
'work': None}
### Fetch user by slug
>>> from facebook_users.models import User
>>> User.remote.fetch('zuck')
<User: Mark Zuckerberg>
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file django-facebook-users-0.3.0.tar.gz
.
File metadata
- Download URL: django-facebook-users-0.3.0.tar.gz
- Upload date:
- Size: 16.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 95cf76abb65d3cef6af52798c41ed61480039f3d22e1ff58615c9fe130a41371 |
|
MD5 | 6667c0b651bcead3027be317244fe7b6 |
|
BLAKE2b-256 | 06acba0614c04f879346264e8a53a3424a25c7c4618c3057ae86483bea4e9746 |