Heyyy am trying to get different genres eg comedy, action from the API in the python view function but am not able to.
def home(request):
#logic for types of movies
movie = get_trending()
random_movies = random.randrange(0,18)
poster = movie['results'][random_movies]
trending = movie['results']
top_rated = get_Toprated()
#action movies
action = get_genres(28)
#animation movies
anime = get_genres(16)
#comegy movies
comedy = get_genres(35)
#horror
horror = get_genres(27)
#documentary
documentary = get_genres(99)
#adventure
adventure = get_genres(12)
#fantasy
fantasy = get_genres(14)
#thrillers
thriller = get_genres(53)
#science fiction
fictions = get_genres(878)
return render(request,'home.html',{
"poster":poster,
"trending":trending,
"action":action,
"horror":horror,
"comedy":comedy(int(id)),
"fantasy":fantasy,
"adventure":adventure,
"thriller":thriller,
"fictions":fictions,
"TopRated":top_rated,
"documentary":documentary,
"anime":anime,
})
here is my code. I think the problem is the context manager but am not able to figure out what to add in order to retrieve the data
Can't find a movie or TV show? Login to create it.
Want to rate or add this item to a list?
Not a member?