mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-14 06:42:16 +00:00
Added API access tracking to EVE Proxy and presented via SSO.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.http import HttpResponse
|
||||
from django.http import HttpResponse, HttpResponseNotFound
|
||||
from eve_proxy.models import CachedDocument
|
||||
|
||||
def retrieve_xml(request):
|
||||
@@ -12,18 +12,28 @@ def retrieve_xml(request):
|
||||
# The parameters attached to the end of the URL path.
|
||||
|
||||
if request.method == 'POST':
|
||||
params = request.POST.urlencode()
|
||||
print params
|
||||
p = request.POST
|
||||
else:
|
||||
params = request.META['QUERY_STRING']
|
||||
print params
|
||||
p = request.GET
|
||||
|
||||
# Convert the QuerySet object into a dict
|
||||
params = {}
|
||||
for key,value in p.items():
|
||||
params[key] = value
|
||||
|
||||
if url_path == '/' or url_path == '':
|
||||
# If they don't provide any kind of query, shoot a quick error message.
|
||||
return HttpResponse('No API query specified.')
|
||||
|
||||
if not 'service' in params:
|
||||
return HttpResponse('No Service ID provided.')
|
||||
|
||||
# The query system will retrieve a cached_doc that was either previously
|
||||
# or newly cached depending on cache intervals.
|
||||
cached_doc = CachedDocument.objects.api_query(url_path, params)
|
||||
# Return the document's body as XML.
|
||||
return HttpResponse(cached_doc.body, mimetype='text/xml')
|
||||
|
||||
if cached_doc:
|
||||
return HttpResponse(cached_doc.body, mimetype='text/xml')
|
||||
|
||||
return HttpResponseNotFound('Error retrieving the document')
|
||||
|
||||
Reference in New Issue
Block a user