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, TagHandler
7 from api import handlers
10 #auth = OAuthAuthentication(realm='API')
11 book_changes_resource = Resource(handler=handlers.BookChangesHandler)
12 tag_changes_resource = Resource(handler=handlers.TagChangesHandler)#, authentication=auth)
13 changes_resource = Resource(handler=handlers.ChangesHandler)
15 urlpatterns = patterns('',
16 url(r'^book_changes/(?P<since>\d*(\.\d*)?)\.(?P<emitter_format>xml|json|yaml)$', book_changes_resource),
17 url(r'^tag_changes/(?P<since>\d*(\.\d*)?)\.(?P<emitter_format>xml|json|yaml)$', tag_changes_resource),
18 url(r'^changes/(?P<since>\d*(\.\d*)?)\.(?P<emitter_format>xml|json|yaml)$', changes_resource),
20 #url(r'^books/(?P<id>[\d,]+)\.(?P<emitter_format>xml|json|yaml)$', book_resource),
21 #url(r'^books\.(?P<emitter_format>xml|json|yaml)$', book_resource),
23 #url(r'^tags/(?P<tags>[a-zA-Z0-9-/]*)\.(?P<emitter_format>xml|json|yaml)$', tag_resource),
24 #url(r'^lektura/(?P<slug>[a-zA-Z0-9-]+)\.(?P<emitter_format>xml|json|yaml)$', book_resource), #detail
25 #url(r'^lektura/(?P<book_slug>[a-zA-Z0-9-]+)/motyw/(?P<theme_slug>[a-zA-Z0-9-]+)\.(?P<emitter_format>xml|json|yaml)$', book_resource), #fragments
26 #url(r'^oauth/callback/$','oauth_callback'),
30 urlpatterns += patterns(
31 'piston.authentication',
32 url(r'^oauth/request_token/$','oauth_request_token'),
33 url(r'^oauth/authorize/$','oauth_user_auth'),
34 url(r'^oauth/access_token/$','oauth_access_token'),