最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

python - themoviedb Endpoint API Connection DNS Error? - Stack Overflow

programmeradmin5浏览0评论

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)"))

发布评论

评论列表(0)

  1. 暂无评论