I am trying to connect to themoviedb API with the following code:
csv_file_path = "FILE PATH"
df = pd.read_csv(csv_file_path)
headers = {
"accept": "application/json",
"Authorization": "KEY"
}
all_movie_data = []
for index, row in df.iterrows():
imdb_id = row["imdb_id"]
url = f"/{imdb_id}"
response = requests.get(url, headers=headers, verify=False)
movie_data = response.json()
print(json.dumps(movie_data, indent=2))
all_movie_data.append(movie_data)
time.sleep(0.5)
output_json_file = "tmdb_movie_data.json"
with open(output_json_file, "w", encoding="utf-8") as f:
json.dump(all_movie_data, f, ensure_ascii=False, indent=2)
I get this error even though I have made all the necessary DNS settings. I also use verify=false
:
ConnectionError: HTTPSConnectionPool(host='api.themoviedb', port=443): Max retries exceeded with url: /3/movie/tt0061036 (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x000001E9476F8F70>: Failed to resolve 'api.themoviedb' ([Errno 11001] getaddrinfo failed)"))