celiao / tmdbsimple

A wrapper for The Movie Database API v3.
GNU General Public License v3.0
579 stars 122 forks source link

tmdbsimple.base.APIKeyError #53

Closed sjuk closed 6 years ago

sjuk commented 6 years ago

Following the examples from the README an APIKeyError is raised after ">>> response = movie.info()". The api key works with the generated url in firefox and with python module tmdb3. Any idea what is wrong?

Thanks in advance :-)

I'm using tmdbsimple on Ubuntu 16.04 with virtualenv and installed it with pip.

$ pip freeze certifi==2018.4.16 chardet==3.0.4 idna==2.6 pkg-resources==0.0.0 requests==2.18.4 tmdbsimple==2.2.0 urllib3==1.22

Due to security reason the value of tmdb.APY_KEY was modified to 'APIKEY'. When trying the command the real key was assigned.

$ python Python 2.7.12 (default, Dec 4 2017, 14:50:18) [GCC 5.4.0 20160609] on linux2 Type "help", "copyright", "credits" or "license" for more information.

import tmdbsimple as tmdb tmdb.APY_KEY = 'APIKEY' movie = tmdb.Movies(603) response = movie.info() Traceback (most recent call last): File "", line 1, in File "/home/sjuk/env/tmdb/local/lib/python2.7/site-packages/tmdbsimple/movies.py", line 66, in info response = self._GET(path, kwargs) File "/home/sjuk/env/tmdb/local/lib/python2.7/site-packages/tmdbsimple/base.py", line 85, in _GET return self._request('GET', path, params=params) File "/home/sjuk/env/tmdb/local/lib/python2.7/site-packages/tmdbsimple/base.py", line 73, in _request params = self._get_params(params) File "/home/sjuk/env/tmdb/local/lib/python2.7/site-packages/tmdbsimple/base.py", line 62, in _get_params raise APIKeyError tmdbsimple.base.APIKeyError

3lixy commented 6 years ago

in your example you have used tmdb.APY_KEY = 'APIKEY' tmdb.APY_KEY = 'APIKEY'

please use tmdb.API_KEY tmdb.API_KEY = 'APIKEY'

It should be API not APY. Easy mistake to make.

sjuk commented 6 years ago

Oh man. What a shame. A simple typo. I wasn't aware this would work with a fantasy name for the variable name. I've learned something. Thank you very much for your help. Now it works as expected. :-)

celiao commented 6 years ago

Thanks for your quick reply, @3lixy.

No worries, @sjuk. Glad you're playing with tmdbsimple!