My flask app keeps bringing up this error when I run the json request to an api, but it runs well from my terminal. What could be wrong? I've loked through the website but none of the solution is applicable. This is my code:
import requests
key = "XpVcEz3pf5hXpJ7psgasaszhMng"
isbns = "2497573957X"
res = requests.get("https://www.goodreads.com/book/review_counts.json",
params={"key": key, "isbns": isbns})
goodreads = res.json()
averageratings = goodreads["books"][0]["average_rating"]
And this is the json result I get from my terminal where I ran the code:
{'books': [{
'id': 29207858,
'isbn': '1632168146',
'isbn13': '9781632168146',
'ratings_count': 0,
'reviews_count': 1,
'text_reviews_count': 0,
'work_ratings_count': 26,
'work_reviews_count': 113,
'work_text_reviews_count': 10,
'average_rating': '4.04'
}]
}