You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.6 KiB
45 lines
1.6 KiB
from django.conf.urls.defaults import *
|
|
from piston.resource import Resource
|
|
from piston.authentication import HttpBasicAuthentication
|
|
from api2.handlers import *
|
|
|
|
# taken from
|
|
# http://www.robertshady.com/content/creating-very-basic-api-using-python-django-and-piston
|
|
class CsrfExemptResource( Resource ):
|
|
def __init__( self, handler, authentication = None ):
|
|
super( CsrfExemptResource, self ).__init__( handler, authentication )
|
|
self.csrf_exempt = getattr( self.handler, 'csrf_exempt', True )
|
|
|
|
|
|
|
|
auth = HttpBasicAuthentication(realm="Freitagsrundenkassensystemapi")
|
|
ad = {'authentication': auth}
|
|
|
|
buyableItemRes = CsrfExemptResource(handler=BuyableItemHandler, **ad)
|
|
buyableTypeRes = CsrfExemptResource(handler=BuyableTypeHandler, **ad)
|
|
|
|
transactionTransactRes = CsrfExemptResource(handler=TransactionTransactHandler, **ad)
|
|
transactionTypeRes = CsrfExemptResource(handler=TransactionTypeHandler, **ad)
|
|
accountBalanceRes = CsrfExemptResource(handler=AccountBalanceHandler, **ad)
|
|
|
|
|
|
authBlobRes = CsrfExemptResource(handler=AuthBlobHandler, **ad)
|
|
configRes = CsrfExemptResource(handler=ConfigHandler, **ad)
|
|
|
|
|
|
urlpatterns = patterns('',
|
|
url(r'buyable/item/$', buyableItemRes),
|
|
url(r'buyable/item/(?P<itemId>\d+)/$', buyableItemRes),
|
|
url(r'buyable/types/$', buyableTypeRes),
|
|
|
|
url(r'account/transactions/transact/$', transactionTransactRes),
|
|
url(r'account/transfers/transfer/$', transactionTransactRes),
|
|
url(r'account/transactions/types/$', transactionTypeRes),
|
|
url(r'account/transfer/types/$', transactionTypeRes),
|
|
url(r'account/balance/$', accountBalanceRes),
|
|
|
|
url(r'auth/blob/$', authBlobRes),
|
|
url(r'config/$', configRes),
|
|
)
|
|
|