Skip to content

SensiPeeps/PyMovieDB

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyMovieDB

A simple python3 wrapper over themoviedb.org API

made-with-python License: MIT PRs Welcome PyPI version Downloads

Install from PyPi

pip install pymoviedb

Synopsis

>>> 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))

Handling exceptions

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!")
    

See also

TMDB API docs: https://developers.themoviedb.org/3/

Remember that this module not support all TMDB API methods yet.

License

This module is licensed under the MIT license. See LICENSE file for more details.