From acb1cb9aa83101f6ccf82339cfdbb3b90bc11b88 Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Wed, 30 Jun 2010 15:13:55 +0100 Subject: [PATCH 1/3] Some small fixes for the OpTimer API call --- api/handlers.py | 2 +- settings.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/api/handlers.py b/api/handlers.py index 674054c..52e7dd3 100755 --- a/api/handlers.py +++ b/api/handlers.py @@ -120,7 +120,7 @@ class OpTimerHandler(BaseHandler): allowed_methods = ('GET') def read(self, request, id=None): - obj = get_object_or_404(EVEAccount, user=FULL_API_USER_ID) + obj = get_object_or_404(EVEAccount, id=FULL_API_USER_ID) params = {'userID':obj.id,'apiKey':obj.api_key,'characterID':FULL_API_CHARACTER_ID} diff --git a/settings.py b/settings.py index 69fc496..b03c05a 100755 --- a/settings.py +++ b/settings.py @@ -123,8 +123,8 @@ REDDIT_PASSWD = '' HR_STAFF_GROUP = 'HR Staff' -FULL_API_USER_ID = 1 -FULL_API_CHARACTER_ID = 217608501 +FULL_API_USER_ID = 415631 +FULL_API_CHARACTER_ID = 246102445 # try and import local settings try: From 5aa65e6a64f1dcba2578283aae1356a2b4d34f7a Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Wed, 30 Jun 2010 15:18:33 +0100 Subject: [PATCH 2/3] For eveproxy, work with parameters as case insensitive (as per Eve API) --- api/handlers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/handlers.py b/api/handlers.py index 52e7dd3..cfa7ac8 100755 --- a/api/handlers.py +++ b/api/handlers.py @@ -105,7 +105,7 @@ class EveAPIProxyHandler(BaseHandler): params = {} for key,value in request.GET.items(): - params[key] = value + params[key.lower()] = value if request.GET.get('userid', None): obj = get_object_or_404(EVEAccount, pk=request.GET.get('userid', None)) From 794d074d4baff4c1a7fed4d3e5dbd86c2ec6d556 Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Thu, 1 Jul 2010 10:26:23 +0100 Subject: [PATCH 3/3] Fixed API argument issues --- api/auth.py | 9 ++++++--- api/handlers.py | 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/api/auth.py b/api/auth.py index 1143fe6..445e488 100644 --- a/api/auth.py +++ b/api/auth.py @@ -6,10 +6,13 @@ class APIKeyAuthentication(object): def is_authenticated(self, request): - apikey = request.GET.get('apikey', None) - if apikey: + params = {} + for key,value in request.GET.items(): + params[key.lower()] = value + + if params['apikey']: try: - keyobj = AuthAPIKey.objects.get(key=apikey) + keyobj = AuthAPIKey.objects.get(key=params['apikey']) except: keyobj = None diff --git a/api/handlers.py b/api/handlers.py index cfa7ac8..158163c 100755 --- a/api/handlers.py +++ b/api/handlers.py @@ -107,8 +107,8 @@ class EveAPIProxyHandler(BaseHandler): for key,value in request.GET.items(): params[key.lower()] = value - if request.GET.get('userid', None): - obj = get_object_or_404(EVEAccount, pk=request.GET.get('userid', None)) + if 'userid' in params: + obj = get_object_or_404(EVEAccount, pk=params['userid']) params['apikey'] = obj.api_key print params