Skip to content

Commit

Permalink
Switching back to post for api
Browse files Browse the repository at this point in the history
  • Loading branch information
the-glu committed Jan 18, 2014
1 parent c961da0 commit 4ab694f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
6 changes: 3 additions & 3 deletions client/libs/polybanking.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def get_transactions(self, max_transaction=100):
data['max_transaction'] = max_transaction

try:
result = requests.get(self.server + '/api/transactions/', params=data).json()
result = requests.post(self.server + '/api/transactions/', data=data).json()
if result['result'] != 'ok':
return None

Expand All @@ -94,7 +94,7 @@ def get_transaction(self, reference):
data['reference'] = reference

try:
result = requests.get(self.server + '/api/transactions/' + reference + '/', params=data).json()
result = requests.post(self.server + '/api/transactions/' + reference + '/', data=data).json()
if result['result'] != 'ok':
return None

Expand All @@ -113,7 +113,7 @@ def get_transaction_logs(self, reference):
data['reference'] = reference

try:
result = requests.get(self.server + '/api/transactions/' + reference + '/logs/', params=data).json()
result = requests.post(self.server + '/api/transactions/' + reference + '/logs/', data=data).json()
if result['result'] != 'ok':
return None

Expand Down
22 changes: 11 additions & 11 deletions server/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from django.shortcuts import get_object_or_404
from django.views.decorators.csrf import csrf_exempt
from django.http import HttpResponse
from django.views.decorators import require_GET
from django.views.decorators import require_POST
from django.utils.translation import ugettext_lazy as _


Expand All @@ -14,15 +14,15 @@


@csrf_exempt
@require_GET
@require_POST
def transactions_list(request):
"""Return the list of transaction"""
config_pk = request.GET.get('config_id', -1)
secret = request.GET.get('secret', '#')
config_pk = request.POST.get('config_id', -1)
secret = request.POST.get('secret', '#')

config = get_object_or_404(Config, pk=config_pk, key_api=secret)
try:
max_transaction = int(request.GET['max_transaction'])
max_transaction = int(request.POST['max_transaction'])
except (ValueError, KeyError):
max_transaction = 100

Expand All @@ -35,11 +35,11 @@ def transactions_list(request):


@csrf_exempt
@require_GET
@require_POST
def transactions_show(request, reference):
"""Return details of a transaction"""
config_pk = request.GET.get('config_id', -1)
secret = request.GET.get('secret', '#')
config_pk = request.POST.get('config_id', -1)
secret = request.POST.get('secret', '#')

config = get_object_or_404(Config, pk=config_pk, key_api=secret)

Expand All @@ -49,11 +49,11 @@ def transactions_show(request, reference):


@csrf_exempt
@require_GET
@require_POST
def transactions_show_logs(request, reference):
"""Return logs of a transaction"""
config_pk = request.GET.get('config_id', -1)
secret = request.GET.get('secret', '#')
config_pk = request.POST.get('config_id', -1)
secret = request.POST.get('secret', '#')

config = get_object_or_404(Config, pk=config_pk, key_api=secret)

Expand Down

0 comments on commit 4ab694f

Please sign in to comment.