Skip to main content
yelp

ezapi-tmdb

pytest Code style: black all-contributors PyPI - License PyPI - Python Version PyPI - Wheel Downloads GitHub Pages

A Python wrapper for TMDb API, supporting version 3 and 4

Install

From PyPi

pip install ezapi-tmdb

From GitHub

pip install git+https://github.com/zehengl/ezapi-tmdb.git

Usage

  1. All endpoints are mapped to functions in a TMDb object
  2. All query string params are used as keyword arguments

Version 3 Example

See Version 3 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

See Version 4 documents for detailed API usage.

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)

Test

git clone git@github.com:zehengl/ezapi-tmdb.git
cd ezapi-tmdb
export tmdb_api_key="..."
export tmdb_username="..."
export tmdb_password="..."
export tmdb_access_token="..."
python -m venv .venv
source .venv/bin/activate
pip install -e .
pip install -r requirements-test.txt
pytest

Use $Env:tmdb_api_key="..." , $Env:tmdb_username="...", $Env:tmdb_password="...", and $Env:tmdb_access_token="..." to set the api key, username, password, and access token environment variables on Windows.

Credits

Contributors ✨

Thanks goes to these wonderful people (emoji key):

Cologler
Cologler

💻
Rafael Pierre
Rafael Pierre

💻
joselimajr
joselimajr

🤔

This project follows the all-contributors specification. Contributions of any kind welcome!

Release files for ezapi-tmdb 0.8.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ezapi-tmdb 0.8.4
File Size Uploaded
ezapi-tmdb-0.8.4.tar.gz 20.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ezapi-tmdb 0.8.4
File Interpreter ABI Platform
ezapi_tmdb-0.8.4-py3-none-any.whl Python 3 none any Details

Total release size: 40.4 kB

Release files / ezapi-tmdb-0.8.4.tar.gz

Download URL ezapi-tmdb-0.8.4.tar.gz
Size 20.4 kB
Tags Source
SHA-256 checksum
How to use checksums
4bc85e7604067ee4db34890b5a1819e9ef707b300c68e4868a3ac00c545cf7b2
BLAKE2b-256 checksum
How to use checksums
80a564745d97a9604a5e5d87e1409e80e28e7c09de2aa8381dfc5f990eb3d957
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.4

Release files / ezapi_tmdb-0.8.4-py3-none-any.whl

Download URL ezapi_tmdb-0.8.4-py3-none-any.whl
Size 20.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bd5f36683a14d02931cce11a8af67bf8c8c0d0398a14d187d86d7f7fc10c5fed
BLAKE2b-256 checksum
How to use checksums
4cfd790192c40f24c244a87fe1058bcdfb52bd2f896536670d57a3a196d27fd8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.4

Release history Release notifications | RSS feed

This release

0.8.4 This release

2 release files

0.8.3

2 release files

0.8.2

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.3

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.2

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page