Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Social connectivitiy as a library

Project Description

Barebones social connection library. Tries to not do everything so you can do anything. Only OAuth1 and OAuth2 currently. Python 3 compatible.


Dendrite doesn’t give you any models, URLS or finished views. It’s up to you to define the behaviour, URLs and models. An example using Instagram follows.


We copy the full Instagram profile. If you don’t want the full profile, you can change the behaviour of OAuth2CallbackView.create_profile in your views.

class InstagramProfile(models.Model):
    id              = models.CharField(max_length=255, primary_key=True)
    username        = models.CharField(max_length=255, blank=True)
    full_name       = models.CharField(max_length=255, blank=True)
    profile_picture = models.URLField(blank=True)
    bio             = models.TextField(blank=True)
    website         = models.URLField(blank=True)
    user            = models.ForeignKey(settings.AUTH_USER_MODEL, related_name='instagram_profiles')
    access_token    = models.CharField(max_length=255, blank=True)

    def __unicode__(self):
        return self.full_name


Create views to handle connection. You can customize the views to behave differently.

from dendrite.views import OAuth2Mixin, OAuth2ConnectView, OAuth2CallbackView

from .models import InstagramProfile

class InstagramMixin(OAuth2Mixin):
    client_id         = settings.INSTAGRAM_CLIENT_ID
    client_secret     = settings.INSTAGRAM_CLIENT_SECRET
    site              = ''
    authorization_url = ''
    token_url         = ''
    redirect_uri      = 'callback' # Name or full URL

    profile_class     = InstagramProfile
    scope             = "basic"

class InstagramConnectView(InstagramMixin, OAuth2ConnectView):

class InstagramCallbackView(InstagramMixin, OAuth2CallbackView):
    def get_remote_profile(self, request, token):
        return token["user"]


Include your social views into your urls.

urlpatterns = patterns(
    url('^social/instagram/connect/$', InstagramConnectView.as_view(), name='connect'),
    url('^social/instagram/callback/$', InstagramCallbackView.as_view(), name='callback'),


Create an additional authentication backend that uses InstagramProfile.

DendriteBackend objects receive the profile class and the full profile information returned by InstagramCallbackView.get_remote_profile.

from dendrite.backends import DendriteBackend

from .models import InstagramProfile

class InstagramBackend(DendriteBackend):
    profile_class = InstagramProfile


Adding API keys and authentication backend.




Release History

This version
History Node


History Node


History Node


History Node


History Node


Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, Size & Hash SHA256 Hash Help File Type Python Version Upload Date
(9.5 kB) Copy SHA256 Hash SHA256
Source None Nov 27, 2013

Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Google Google Cloud Servers