itirate over api data

PHOTO EMBED

Sat Nov 07 2020 07:36:33 GMT+0000 (UTC)

Saved by @le_wiseman #dj #py

discover_api_url = 'https://api.themoviedb.org/3/discover/movie?api_key=2bca7835c548e3242e8ccc0aa44a0513&language=en-US&sort_by=popularity.desc&include_adult=false&include_video=false&primary_release_year=>%3D2004&with_genres=18' 
    discover_api = requests.get(discover_api_url).json()
    most_popular_films = discover_api["results"]
    for page in range(2, discover_api["total_pages"]+1):
        discover_api = requests.get(discover_api_url + f"&page={page}").json()
        most_popular_films.extend(discover_api["results"])
        response = enumerate(most_popular_films)
content_copyCOPY

TMDB api change the page to next