API

class django_facebook.api.FacebookUserConverter(open_facebook)[source]

This conversion class helps you to convert Facebook users to Django users

Helps with - extracting and prepopulating full profile data - invite flows - importing and storing likes

facebook_profile_data()[source]

Returns the facebook profile data, together with the image locations

facebook_registration_data(username=True)[source]

Gets all registration data and ensures its correct input for a django registration

get_and_store_friends(user)[source]

Gets and stores your facebook friends to DB Both the get and the store run in a async task when FACEBOOK_CELERY_STORE = True

get_and_store_likes(user)[source]

Gets and stores your facebook likes to DB Both the get and the store run in a async task when FACEBOOK_CELERY_STORE = True

get_friends(limit=5000)[source]

Connects to the facebook api and gets the users friends

get_likes(limit=5000)[source]

Parses the facebook response and returns the likes

registered_friends(user)[source]

Returns all profile models which are already registered on your site and a list of friends which are not on your site

store_friends(user, friends)[source]

Stores the given friends locally for this user Quite slow, better do this using celery on a secondary db

store_likes(user, likes)[source]

Given a user and likes store these in the db Note this can be a heavy operation, best to do it in the background using celery

django_facebook.api.get_facebook_graph(request=None, access_token=None, redirect_uri=None, raise_=False)[source]

given a request from one of these - js authentication flow (signed cookie) - facebook app authentication flow (signed cookie) - facebook oauth redirect (code param in url) - mobile authentication flow (direct access_token) - offline access token stored in user profile

returns a graph object

redirect path is the path from which you requested the token for some reason facebook needs exactly this uri when converting the code to a token falls back to the current page without code in the request params specify redirect_uri if you are not posting and recieving the code on the same page

django_facebook.api.get_persistent_graph(request, *args, **kwargs)[source]

Wraps itself around get facebook graph But stores the graph in the session, allowing usage across multiple pageviews. Note that Facebook session’s expire at some point, you can’t store this for permanent usage Atleast not without asking for the offline_access permission

django_facebook.api.require_facebook_graph(request, *args, **kwargs)[source]

Just like get_facebook graph, but instead of returning None raise an OpenFacebookException if we can’t access facebook

django_facebook.api.require_persistent_graph(request, *args, **kwargs)[source]

Just like get_persistent graph, but instead of returning None raise an OpenFacebookException if we can’t access facebook