A Python wrapper for TMDb API
Project description
ezapi-tmdb
A Python wrapper for TMDb API, supporting version 3 and 4
Install
pip install ezapi-tmdb
Test
git clone git@github.com:zehengl/ezapi-tmdb.git
export api_key="..."
export username="..."
export password="..."
export access_token="..."
cd ezapi-tmdb
python setup.py test
Use $Env:api_key="..."
, $Env:username="..."
, $Env:password="..."
, and $Env:access_token="..."
to set the api key, username, password, and access token environment variables on Windows.
Usage
- All endpoints are mapped to functions in a
TMDb
object - All query string params are used as keyword arguments
Version 3 Example
See documents for detailed API usage.
from tmdb import TMDb3
api_key = "..."
tmdb = TMDb3(api_key)
# query string params are used as keyword arguments
print(tmdb.get_popular_movies(region="US"))
print(tmdb.get_tvs_on_the_air(page=10))
# create session_id with username/password login
username = "..."
password = "..."
request_token = tmdb.create_request_token().get("request_token")
tmdb.create_session_with_login(username, password, request_token)
session_id = tmdb.create_session(request_token).get("session_id")
# some endpoints require session_id
print(tmdb.get_account_details(session_id=session_id))
# store global options, language / region for example
tmdb.set_options(language="de", region="de")
tmdb.get_trending("all", "week")
# reset global options
tmdb.reset_options()
# configure image languages globally
tmdb.set_options(include_image_language=["en", "null"])
tmdb.get_movie_images(597)
# url param per request would overwrite global options
tmdb.get_movie_images(597, include_image_language=["de", "fr"])
Version 4 Example
from tmdb import TMDb4
# API Read Access Token from the settings page
access_token = "..."
tmdb = TMDb4(access_token)
# create a user access token
request_token = tmdb.create_request_token().get("request_token")
print(f"https://www.themoviedb.org/auth/access?request_token={request_token}")
# click on the link above, sign in, then approve access
resp = tmdb.create_access_token(request_token)
# extract the user access token and account id for v4 api
user_access_token = resp.get("access_token")
account_id = resp.get("account_id")
tmdb.update_access_token(user_access_token)
tmdb.get_list(14105)
tmdb.get_account_favorite_movies(account_id)
Credits
-
Icon from www.themoviedb.org
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ezapi_tmdb-0.7.0.tar.gz
(15.2 kB
view details)
Built Distribution
File details
Details for the file ezapi_tmdb-0.7.0.tar.gz
.
File metadata
- Download URL: ezapi_tmdb-0.7.0.tar.gz
- Upload date:
- Size: 15.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 03bc7cdcbb6b2da0fad1a5ced714ba3d5bde9bd027c0d515e61acdd8c43d5258 |
|
MD5 | 5c949bacf44a1c50fffc39d6108397ad |
|
BLAKE2b-256 | 77b4440db840e67aafaf2ceabd37de02758e663ae905d00d04087a420eb3aa47 |
File details
Details for the file ezapi_tmdb-0.7.0-py3-none-any.whl
.
File metadata
- Download URL: ezapi_tmdb-0.7.0-py3-none-any.whl
- Upload date:
- Size: 30.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 595e7db3f65398d8867c2cf43773e99330c52a6f75f6b1d640cc9a33d78bca80 |
|
MD5 | 9ec0e1a49117a0e18a239dbfa9a9271d |
|
BLAKE2b-256 | ad9b121c620665b1db1f938bb156397141604df677efef10c16ec18ea689cddc |