1 # -*- coding: utf-8 -*-
2 from django.conf.urls.defaults import *
3 from piston.resource import Resource
4 from piston.authentication import OAuthAuthentication
6 from api.handlers import BookHandler
9 auth = OAuthAuthentication(realm="Wolne Lektury")
10 book_resource = Resource(handler=BookHandler, authentication=auth)
13 urlpatterns = patterns('',
14 url(r'^books/(?P<slug>[^/]+)\.(?P<emitter_format>xml|json|yaml)$', book_resource),
15 url(r'^books\.(?P<emitter_format>xml|json|yaml)$', book_resource),
18 'piston.authentication',
19 url(r'^oauth/request_token/$','oauth_request_token'),
20 url(r'^oauth/authorize/$','oauth_user_auth'),
21 url(r'^oauth/access_token/$','oauth_access_token'),