added support for movie search

This commit is contained in:
Edward Tirado Jr 2025-04-13 01:47:22 -05:00
parent 3117bac8a9
commit 29f0e73c0b
18 changed files with 198 additions and 32 deletions

12
movie_db/views.py Normal file
View file

@ -0,0 +1,12 @@
from django.http import JsonResponse
from movie_db.db_providers.omdb import OMDb
def omdb_search(request):
query = request.GET.get("q")
if not query:
return JsonResponse({"Error": "Missing query"}, status=400)
search_type = request.GET.get("type")
omdb = OMDb()
return JsonResponse(omdb.search(query, {"type": search_type}), safe=False)