A simple python3 wrapper over themoviedb.org API
pip install pymoviedb
>>> from pymoviedb import Movie, TvShow
>>> APIKEY = "you-api-key"
# Create a Movie object
>>> mv = Movie(APIKEY)
# search for queries
>>> mv.search("Titanic")
# search using id
>>> mv.searchid(597)
# Get trending movies for "day" or "week"
# by default it's "week"
>>> mv.trending("day")
# Get recommendations by id
>>> mv.recommendations(597)
# Similarly for tvshows
>>> tv = TvShow(APIKEY)
>>> tv.search("Breaking bad")
# All methods can be found by using dir() function
>>> print(dir(Movie))
Exceptions can be imported from pymoviedb.excs
for easy error handling.
Example:
from pymoviedb.excs import ZeroResultsFound, TmdbApiError
tv = TvShows(APIKEY)
try:
print(tv.search("xsxsxsx"))
except ZeroResultsFound:
print("Nothing found!")
try:
print(tv.searchid("xsxsxsxs"))
except TmdbApiError as e:
print("invalid query!")
TMDB API docs: https://developers.themoviedb.org/3/
Remember that this module not support all TMDB API methods yet.
This module is licensed under the MIT license. See LICENSE file for more details.