From 114bbdfe8b5996d7d714ce24c4cdec0f8b2c9ae6 Mon Sep 17 00:00:00 2001 From: Sagi Dayan Date: Tue, 12 May 2015 17:13:38 +0300 Subject: [PATCH] API: Fixed response in getUserByToken. returning JSON and not a string --- SE_API/API.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/SE_API/API.py b/SE_API/API.py index a321dfd..e6382bc 100644 --- a/SE_API/API.py +++ b/SE_API/API.py @@ -6,7 +6,7 @@ from google.appengine.ext import db import requests import uuid -from flask import Flask, request, render_template, redirect, abort +from flask import Flask, request, render_template, redirect, abort, Response from flask.ext.github import GitHub from flask.ext.cors import CORS, cross_origin @@ -62,9 +62,14 @@ def getUserByToken(token): query.filter("seToken = ", token) for u in query.run(limit=5): - return u.to_JSON() + return Response(response=u.to_JSON(), + status=201, + mimetype="application/json") # Real response! + + return Response(response=json.dumps({'message' : 'No User Found'}), + status=403, + mimetype="application/json") - return json.dumps({'message' : 'No User Found'}), 403 @app.route('/githubOAuth')