Closed rhagarty closed 6 years ago
Ah - so you did install tmdbsimple
but did not set the API_KEY
? I'll amend the code to catch that error too so that it falls back to the text-only display.
I can't reproduce this exact error.
If I have installed tmdbsimple
, but did not run the "Toy Story poster test cell", and also have not set the API key, I get:
APIKeyError Traceback (most recent call last)
<ipython-input-28-13f0c7366a96> in <module>()
----> 1 display_similar(2628, num=5)
<ipython-input-27-9c5a8e0290b5> in display_similar(the_id, q, num, index, dt)
133 """
134 movie, recs = get_similar(the_id, q, num, index, dt)
--> 135 q_im_url = get_poster_url(movie['tmdbId'])
136 if q_im_url == "NA":
137 display(HTML("<i>Cannot import tmdbsimple, no movie posters will be displayed!</i>"))
<ipython-input-27-9c5a8e0290b5> in get_poster_url(id)
6 try:
7 import tmdbsimple as tmdb
----> 8 movie = tmdb.Movies(id).info()
9 poster_url = IMAGE_URL + movie['poster_path'] if 'poster_path' in movie and movie['poster_path'] is not None else ""
10 return poster_url
~/miniconda3/lib/python3.6/site-packages/tmdbsimple/movies.py in info(self, **kwargs)
61 path = self._get_id_path('info')
62
---> 63 response = self._GET(path, kwargs)
64 self._set_attrs_to_values(response)
65 return response
~/miniconda3/lib/python3.6/site-packages/tmdbsimple/base.py in _GET(self, path, params)
83
84 def _GET(self, path, params=None):
---> 85 return self._request('GET', path, params=params)
86
87 def _POST(self, path, params=None, payload=None):
~/miniconda3/lib/python3.6/site-packages/tmdbsimple/base.py in _request(self, method, path, params, payload)
71 def _request(self, method, path, params=None, payload=None):
72 url = self._get_complete_url(path)
---> 73 params = self._get_params(params)
74
75 response = requests.request(
~/miniconda3/lib/python3.6/site-packages/tmdbsimple/base.py in _get_params(self, params)
60 from . import API_KEY
61 if not API_KEY:
---> 62 raise APIKeyError
63
64 api_dict = {'api_key': API_KEY}
APIKeyError:
However if I do run the poster test cell I then get:
HTTPError: 401 Client Error: Unauthorized for url: https://api.themoviedb.org/3/movie/1893?api_key=YOUR_API_KEY
What Python version are you using?
All the recommendation steps at the end of the notebook had errors, all similar to the following:
NameError Traceback (most recent call last)
%s