1 # -*- coding: utf-8 -*-
2 from django.conf.urls.defaults import *
3 from piston.resource import Resource
4 from piston.authentication import HttpBasicAuthentication
6 from api.handlers import BookHandler
9 auth = HttpBasicAuthentication(realm='My sample API')
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),