Simple 2-legged OAuth connector for django piston.
Python
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
.gitignore
LICENSE
README.md

README.md

About

django-piston-two-legged-oauth is a simple 2-legged OAuth connector for Django Piston.

Dependencies:

Adapted from example:

Related discussions:

Example

# urls.py

from api.authentication import TwoLeggedOAuthAuthentication
from api.handlers import DoSomethingHandler

two_legged_oauth = TwoLeggedOAuthAuthentication(realm='API')

class CsrfExemptResource( Resource ):
    def __init__( self, handler, authentication = None ):
        super( CsrfExemptResource, self ).__init__( handler, authentication )
        self.csrf_exempt = getattr( self.handler, 'csrf_exempt', True )

def TwoLeggedOAuthProtectedResource(handler):
    return CsrfExemptResource(handler=handler, authentication=two_legged_oauth)

do_something = TwoLeggedOAuthProtectedResource( DoSomethingHandler )

urlpatterns = patterns('',
    url( r'^do_something', do_something, name='do_something'),
)