this code works perfect with movie Id that has plot keyword .
from imdb import IMDb
ia = IMDb()
black_panther = ia.get_movie('1825683', info='keywords')
print(black_panther['keywords'])
bur for movies that haven't plot keyword like this id(5950092) it returns exception.any idea for handle exception?
Since
imdb.Movie.Movie
is a subclass ofimdb.utils._Container
with aget
method similar to that of adict
, and which docstring reads:That means you can do this to never throw an exception if there are no keywords:
You can also work with an
Exception
if you want to: