Hi, I started to write tmdb from scratch. It's easier that way, and it supports API v3.
- Old wrapper renamed to themoviedb_oldapi: https://github.com/doganaydin/themoviedb_oldapi
- Temporarily, only movie search api is implemented.
- Please edit wiki page to add yourself to WhoUses page.
$ pip install requests fuzzywuzzy
$ sudo python setup.py install
# Alternatively, for Python 3:
$ sudo python3 setup.py install
First, you need to get an API key from TMDB
(you'll need a user account for that). Then, assuming that api_key
is a
string containing your API key:
import tmdb
tmdb.configure(api_key)
# Search for movie titles containing "Alien"
movies = tmdb.Movies("Alien")
for movie in movies.iter_results():
# Pick the movie whose title is exactly "Alien"
if movie["title"] == "Alien":
# Create a Movie object, fetching details about it
movie = tmdb.Movie(movie["id"])
break
# Access the fetched information about the movie
movie.get_tagline() # or other methods...
For a complete list of methods currently available in Movie
objects, type
help(tmdb.Movie)
on the Python prompt.
If movie search hangs for too long, use limit=True
:
movies = tmdb.Movies("matrix", limit=True)
. Now movie search only returns the
first page of results.
In order to modify a movie on TMDB, you'll need to authenticate first:
import tmdb
tmdb.configure(api_key)
auth = tmdb.Core()
rt = auth.request_token()
auth.session_id(rt["request_token"])
# Now you can for instance rate the movie
movie.add_rating(1)
Thomas @tloiret
Martin Lenders @authmillenon
lad1337 @lad1337
George Dorn @georgedorn
Farrin Reid @blakmatrix
Benoît Knecht @BenoitKnecht
Alan Justino da Silva @alanjds
Dustin Wyatt @therms