Skip to content
Snippets Groups Projects
Commit f74f9716 authored by Tor-Einar Skog's avatar Tor-Einar Skog
Browse files

Possible fix for TypeError

parent 4e209daf
No related branches found
No related tags found
No related merge requests found
......@@ -18,7 +18,7 @@
# @author: Tor-Einar Skog <tor-einar.skog@nibio.no>
import datetime
from django.shortcuts import render
from django.http import HttpResponse, JsonResponse, HttpResponseBadRequest, HttpResponseNotAllowed
from django.http import HttpResponse, HttpResponseBadRequest, HttpResponseNotAllowed
from django.conf import settings
from django.utils import translation
import requests
......@@ -87,19 +87,14 @@ def vipslogicproxy(request, path):
else:
return HttpResponseNotAllowed("Permitted methods are POST and GET")
params = request.urlencode()
#print params
#print "Params:" + params
try:
url = "%s://%s/%s" % (settings.VIPSLOGIC_PROTOCOL, settings.VIPSLOGIC_SERVER_NAME,path)
print url
#print url
except KeyError:
return HttpResponseBadRequest("URL must be defined")
response = r(url, params=params)
response = r(url.encode("ascii"), params=params.encode("ascii"))
if response.status_code == 200:
return HttpResponse(response.text, status=int(response.status_code), content_type=response.headers.get('content-type',"text/plain"))
else:
return HttpResponse("[]", status=200, content_type="application/json")
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment