Skip to content

SensiPeeps/PyMovieDB

Folders and files

NameName
Last commit message
Last commit date

Latest commit

755f795 · Sep 11, 2020

History

18 Commits
Sep 11, 2020
Sep 6, 2020
Sep 6, 2020
Sep 5, 2020
Sep 5, 2020
Sep 6, 2020
Sep 6, 2020

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, TvShows
>>> 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 = TvShows(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
tv = TvShows(APIKEY)

try:
    print(tv.search("xsxsxsx"))
except ZeroResultsFound:
     print("Nothing found!")

See also

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

This library is being used by my telegram bot αcutєвσt, Check that out to see live working example!

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.