Code Monkey home page Code Monkey logo

banana-py's Introduction

BananaPy

BananaPy provides you with a way to authenticate your Django application with MailChimp's new OAuth2 service.

Installation and Usage

BananaPy requires Python-OAuth2 from SimpleGeo and the simplejson library, both of which should be installed automatically if not already installed. You can get BananaPy from its Github repo (https://github.com/kennethlove/Banana-Py/) or through PyPi by:

easy_install banana_py

or:

pip install banana_py

Let everything install and then set up your MailChimp app. Set the redirect uri on your MailChimp app to:

http://your-domain.com/bananas/ripe/

Add banana_py to your INSTALLED_APPS:

INSTALLED_APPS = (
    ...
    'banana_py',
    ...
)

Then add the following four settings to your settings.py:

MAILCHIMP_CLIENT_ID = '123456789'
MAILCHIMP_CLIENT_SECRET = 'a1b2c3d4e5f6789'
MAILCHIMP_REDIRECT_URI = 'http://your-domain.com/bananas/ripe/'
MAILCHIMP_COMPLETE_URI = 'http://your-domain.com/'

The last setting, MAILCHIMP_COMPLETE_URI can be anything you want, a Profile page or some view of your own that creates a user account for the new user.

Add URLs entries:

urlpatterns = patterns('',
    ...
    url(r'', include('banana_py.urls')),
    ...
)

In the template(s) where you want to display the authorize link:

{% load banana_tags %}
{% banana_auth_url "Authorize" %}

This will print out an HTML anchor tag with the appropriate link and the supplied text as the link text.

Once the user completes the authorization workflow (and ends up on your MAILCHIMP_COMPLETE_URI view), their MailChimp-provided authorization information will be available in the request.session object as mailchimp_details.

Thanks

Our thanks to the MailChimp team for letting us build this bridge. Also to Joe Stump and the rest of the SimpleGeo team for making their awesome OAuth2 library. Also, thanks to the Django team, without whom this wouldn't really be needed!

banana-py's People

Contributors

chrisjones-brack3t avatar kennethlove avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.