celiao / tmdbsimple

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

'Account' object has no attribute 'id' #92

Closed henrydatei closed 1 year ago

henrydatei commented 1 year ago

I want to retrieve my favourite movies:

import tmdbsimple as tmdb

tmdb.API_KEY = 'my api key'

fav = tmdb.Account(session_id = "my session id").favorite_movies()
print(fav)

I get

Traceback (most recent call last):
  File "/Users/henryhaustein/Downloads/tmdb2movielens.py", line 5, in <module>
    fav = tmdb.Account(session_id = "***").favorite_movies()
  File "/usr/local/lib/python3.10/site-packages/tmdbsimple/account.py", line 92, in favorite_movies
    path = self._get_id_path('favorite_movies')
  File "/usr/local/lib/python3.10/site-packages/tmdbsimple/base.py", line 40, in _get_id_path
    return self._get_path(key).format(id=self.id)
AttributeError: 'Account' object has no attribute 'id'

What am I doing wrong?

henrydatei commented 1 year ago

Ok I found the issue. I have to call account.info() before I can access the favourite movies.

celiao commented 1 year ago

Great! Closing issue.