|
|
|
@ -3,25 +3,37 @@ 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 = Resource(handler=BuyableItemHandler, **ad)
|
|
|
|
|
buyableTypeRes = Resource(handler=BuyableTypeHandler, **ad)
|
|
|
|
|
buyableItemRes = CsrfExemptResource(handler=BuyableItemHandler, **ad)
|
|
|
|
|
buyableTypeRes = CsrfExemptResource(handler=BuyableTypeHandler, **ad)
|
|
|
|
|
|
|
|
|
|
transactionTransactRes = Resource(handler=TransactionTransactHandler, **ad)
|
|
|
|
|
transactionTypeRes = Resource(handler=TransactionTypeHandler, **ad)
|
|
|
|
|
transactionTransactRes = CsrfExemptResource(handler=TransactionTransactHandler, **ad)
|
|
|
|
|
transactionTypeRes = CsrfExemptResource(handler=TransactionTypeHandler, **ad)
|
|
|
|
|
|
|
|
|
|
authBlobRes = Resource(handler=AuthBlobHandler, **ad)
|
|
|
|
|
configRes = Resource(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'transaction/transact/', transactionTransactRes),
|
|
|
|
|
url(r'transaction/types/', transactionTypeRes),
|
|
|
|
|
url(r'transaction/transact/$', transactionTransactRes),
|
|
|
|
|
url(r'transaction/types/$', transactionTypeRes),
|
|
|
|
|
|
|
|
|
|
url(r'auth/blob/', authBlobRes),
|
|
|
|
|
url(r'auth/blob/$', authBlobRes),
|
|
|
|
|
url(r'config/$', configRes),
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|