Skip to main content

A Python wrapper for TMDb API

Project description

logo yelp

ezapi-tmdb

pytest Code style: black PyPI - License PyPI - Python Version PyPI Downloads

A Python wrapper for TMDb API, supporting version 3

Install

pip install ezapi-tmdb

Test

git clone git@github.com:zehengl/ezapi-tmdb.git
export api_key="..."
export username="..."
export password="..."
cd ezapi-tmdb
python setup.py test

Use $Env:api_key="..." , $Env:username="...", and $Env:password="..." to set the api key, username, and password environment variables on Windows.

Usage

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

See documents for detailed API usage.

from tmdb import TMDb

api_key = "..."

tmdb = TMDb(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"])

Credits

Project details


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.6.2.tar.gz (11.8 kB view hashes)

Uploaded Source

Built Distribution

ezapi_tmdb-0.6.2-py3-none-any.whl (27.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page