Compare commits

..

No commits in common. "8602784c0d077cd4216c14ac1d35241373d28c7c" and "b25f5c66e1d70433c1e95f44924bb13b01746a8f" have entirely different histories.

View file

@ -9,17 +9,4 @@ def omdb_search(request):
search_type = request.GET.get("type") search_type = request.GET.get("type")
omdb = OMDb() omdb = OMDb()
return JsonResponse(omdb.search(query, {"type": search_type}), safe=False)
results = omdb.search(query, {"type": search_type})
if "error" in results:
return parse_error(results)
return JsonResponse(results, safe=False)
def parse_error(results):
error_json = results["error"]
if "Error" in error_json and error_json["Error"] == "Movie not found!":
return JsonResponse({}, status=404)
else:
return JsonResponse("Error while searching for movie.", status=500)