|Code Quality Score| |Code Grade| |Code Coverage| |PyPI Version| |Code style: black| |PyPI License|
themoviedb
==========
A modern and easy to use API wrapper for The Movie Database (TMDb) API v3
written in Python. Supports sync and async requests!
Overview
========
The **themoviedb** is a synchronous and asynchronous wrapper, written in Python,
for The Movie Database (TMDb) API v3.
`The Movie Database (TMDb) <https://www.themoviedb.org>`__ is a
community built movie and TV database.
The `TMDb API <https://www.themoviedb.org/documentation/api>`__ service
is for those of you interested in using our movie, TV show or actor
images and/or data in your application.
A `TMDb user account <https://www.themoviedb.org/account/signup>`__ is
required to request an API key.
Getting started
===============
Requirements
------------
- ``python`` (Python >=3.8)
- ``pip`` (Python package manager)
Install
-------
The easiest way to install themoviedb is via ``pip``.
::
pip install themoviedb
API Key
-------
You will need an API key to The Movie Database to access the API. To
obtain a key, follow these steps:
1. `Register <https://www.themoviedb.org/account/signup>`__ for and
verify an account.
2. `Log <https://www.themoviedb.org/login>`__ into your account.
3. Select the `API section <https://www.themoviedb.org/settings/api>`__
on left side of your account page.
4. Click on the link to generate a new API key and follow the
instructions.
Usage
=====
Sync mode
---------
.. code:: python
from themoviedb import TMDb
Async mode
----------
.. code:: python
from themoviedb import aioTMDb
Configuration
-------------
Initialize a TMDb object and set your API Key, language and region.
.. code:: python
tmdb = TMDb(key="YOUR_API_KEY", language="pt-BR", region="BR")
# or: tmdb = aioTMDb(key="YOUR_API_KEY", language="pt-BR", region="BR")
Alternatively, set after initialize.
.. code:: python
tmdb = TMDb()
# or: tmdb = aioTMDb()
tmdb.key = "YOUR_API_KEY"
tmdb.language = "pt-BR" # default: en-US
tmdb.region = "BR" # default: US
Alternatively too, you can export your API key, language and region
logger as an environment variable.
.. code:: bash
$ export TMDB_KEY="YOUR_API_KEY"
$ export TMDB_LANGUAGE="pt-BR" # ISO 639-1
$ export TMDB_REGION="BR" # ISO-3166-1
And then you will no longer need to set your API key, language and region.
.. code:: python
tmdb = TMDb() # from env: TMDB_KEY="YOUR_API_KEY", TMDB_LANGUAGE="pt-BR", TMDB_REGION="BR"
# or: tmdb = aioTMDb()
Examples
--------
Get the list of top rated movies (sync mode).
.. code:: py
from themoviedb import TMDb
tmdb = TMDb()
movies = tmdb.movies().top_rated()
for movie in movies:
print(movie)
Get the list of popular TV shows (async mode).
.. code:: py
import asyncio
from themoviedb import aioTMDb
async def main():
tmdb = aioTMDb()
movies = await tmdb.tvs().popular()
for movie in movies:
print(movie)
asyncio.run(main())
Discover movies by different types of data.
.. code:: py
from themoviedb import TMDb
tmdb = TMDb()
movies = tmdb.discover().movie(
sort_by="vote_average.desc",
primary_release_date__gte="1997-08-15",
vote_count__gte=10000,
vote_average__gte=6.0,
)
for movie in movies:
print(movie)
Get the details of movie for a search.
.. code:: py
import asyncio
from themoviedb import aioTMDb
async def main():
tmdb = aioTMDb()
movies = await tmdb.search().movies("fight club")
movie_id = movies[0].id # get first result
movie = await tmdb.movie(movie_id).details(append_to_response="credits,external_ids,images,videos")
print(movie.title, movie.year)
print(movie.tagline)
print(movie.poster_url)
print(movie.external_ids.imdb_url)
for person in movie.credits.cast:
print(person.name, person.character)
asyncio.run(main())
.. |Code Quality Score| image:: https://api.codiga.io/project/36067/score/svg
:target: https://app.codiga.io/hub/project/36067/themoviedb
.. |Code Grade| image:: https://api.codiga.io/project/36067/status/svg
:target: https://app.codiga.io/hub/project/36067/themoviedb
.. |Code Coverage| image:: https://codecov.io/gh/leandcesar/themoviedb/branch/master/graph/badge.svg?token=OOILIE0RTS
:target: https://codecov.io/gh/leandcesar/themoviedb
.. |Code style: black| image:: https://img.shields.io/badge/code%20style-black-000000.svg
:target: https://github.com/psf/black
.. |PyPI Version| image:: https://img.shields.io/pypi/v/themoviedb?color=blue
:target: https://pypi.org/project/themoviedb/
.. |PyPI License| image:: https://img.shields.io/pypi/l/themoviedb.svg
:target: https://img.shields.io/pypi/l/themoviedb.svg
Raw data
{
"_id": null,
"home_page": "https://github.com/leandcesar/themoviedb",
"name": "themoviedb",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "tmdb,tmdb3,aiotmdb,aiotmdb3,themoviedb,themoviedb3,sync,async,await,aio,movie,movies,tv,tv show,tv shows,api,wrapper",
"author": "Leandro C\u00e9sar",
"author_email": "ccleandroc@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/f7/07/396eabaf62eaa3d09e0ec28a486a295278a38c165bce2c9424a396b3e234/themoviedb-0.4.0.tar.gz",
"platform": null,
"description": "|Code Quality Score| |Code Grade| |Code Coverage| |PyPI Version| |Code style: black| |PyPI License|\n\nthemoviedb\n==========\n\nA modern and easy to use API wrapper for The Movie Database (TMDb) API v3\nwritten in Python. Supports sync and async requests!\n\nOverview\n========\n\nThe **themoviedb** is a synchronous and asynchronous wrapper, written in Python,\nfor The Movie Database (TMDb) API v3.\n\n`The Movie Database (TMDb) <https://www.themoviedb.org>`__ is a\ncommunity built movie and TV database.\n\nThe `TMDb API <https://www.themoviedb.org/documentation/api>`__ service\nis for those of you interested in using our movie, TV show or actor\nimages and/or data in your application.\n\nA `TMDb user account <https://www.themoviedb.org/account/signup>`__ is\nrequired to request an API key.\n\nGetting started\n===============\n\nRequirements\n------------\n\n- ``python`` (Python >=3.8)\n- ``pip`` (Python package manager)\n\nInstall\n-------\n\nThe easiest way to install themoviedb is via ``pip``.\n\n::\n\n pip install themoviedb\n\nAPI Key\n-------\n\nYou will need an API key to The Movie Database to access the API. To\nobtain a key, follow these steps:\n\n1. `Register <https://www.themoviedb.org/account/signup>`__ for and\n verify an account.\n2. `Log <https://www.themoviedb.org/login>`__ into your account.\n3. Select the `API section <https://www.themoviedb.org/settings/api>`__\n on left side of your account page.\n4. Click on the link to generate a new API key and follow the\n instructions.\n\nUsage\n=====\n\nSync mode\n---------\n\n.. code:: python\n\n from themoviedb import TMDb\n\nAsync mode\n----------\n\n.. code:: python\n\n from themoviedb import aioTMDb\n\nConfiguration\n-------------\n\nInitialize a TMDb object and set your API Key, language and region.\n\n.. code:: python\n\n tmdb = TMDb(key=\"YOUR_API_KEY\", language=\"pt-BR\", region=\"BR\")\n # or: tmdb = aioTMDb(key=\"YOUR_API_KEY\", language=\"pt-BR\", region=\"BR\")\n\nAlternatively, set after initialize.\n\n.. code:: python\n\n tmdb = TMDb()\n # or: tmdb = aioTMDb()\n tmdb.key = \"YOUR_API_KEY\"\n tmdb.language = \"pt-BR\" # default: en-US\n tmdb.region = \"BR\" # default: US\n\nAlternatively too, you can export your API key, language and region\nlogger as an environment variable.\n\n.. code:: bash\n\n $ export TMDB_KEY=\"YOUR_API_KEY\"\n $ export TMDB_LANGUAGE=\"pt-BR\" # ISO 639-1\n $ export TMDB_REGION=\"BR\" # ISO-3166-1\n\nAnd then you will no longer need to set your API key, language and region.\n\n.. code:: python\n\n tmdb = TMDb() # from env: TMDB_KEY=\"YOUR_API_KEY\", TMDB_LANGUAGE=\"pt-BR\", TMDB_REGION=\"BR\"\n # or: tmdb = aioTMDb()\n\nExamples\n--------\n\nGet the list of top rated movies (sync mode).\n\n.. code:: py\n\n from themoviedb import TMDb\n\n tmdb = TMDb()\n movies = tmdb.movies().top_rated()\n for movie in movies:\n print(movie)\n\nGet the list of popular TV shows (async mode).\n\n.. code:: py\n\n import asyncio\n from themoviedb import aioTMDb\n\n async def main():\n tmdb = aioTMDb()\n movies = await tmdb.tvs().popular()\n for movie in movies:\n print(movie)\n\n asyncio.run(main())\n\nDiscover movies by different types of data.\n\n.. code:: py\n\n from themoviedb import TMDb\n\n tmdb = TMDb()\n movies = tmdb.discover().movie(\n sort_by=\"vote_average.desc\",\n primary_release_date__gte=\"1997-08-15\",\n vote_count__gte=10000,\n vote_average__gte=6.0,\n )\n for movie in movies:\n print(movie)\n\nGet the details of movie for a search.\n\n.. code:: py\n\n import asyncio\n from themoviedb import aioTMDb\n\n async def main():\n tmdb = aioTMDb()\n movies = await tmdb.search().movies(\"fight club\")\n movie_id = movies[0].id # get first result\n movie = await tmdb.movie(movie_id).details(append_to_response=\"credits,external_ids,images,videos\")\n print(movie.title, movie.year)\n print(movie.tagline)\n print(movie.poster_url)\n print(movie.external_ids.imdb_url)\n for person in movie.credits.cast:\n print(person.name, person.character)\n\n asyncio.run(main())\n\n.. |Code Quality Score| image:: https://api.codiga.io/project/36067/score/svg\n :target: https://app.codiga.io/hub/project/36067/themoviedb\n.. |Code Grade| image:: https://api.codiga.io/project/36067/status/svg\n :target: https://app.codiga.io/hub/project/36067/themoviedb\n.. |Code Coverage| image:: https://codecov.io/gh/leandcesar/themoviedb/branch/master/graph/badge.svg?token=OOILIE0RTS \n :target: https://codecov.io/gh/leandcesar/themoviedb\n.. |Code style: black| image:: https://img.shields.io/badge/code%20style-black-000000.svg\n :target: https://github.com/psf/black\n.. |PyPI Version| image:: https://img.shields.io/pypi/v/themoviedb?color=blue\n :target: https://pypi.org/project/themoviedb/\n.. |PyPI License| image:: https://img.shields.io/pypi/l/themoviedb.svg\n :target: https://img.shields.io/pypi/l/themoviedb.svg\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A modern and easy to use API wrapper for The Movie Database (TMDb) API v3 written in Python",
"version": "0.4.0",
"project_urls": {
"Homepage": "https://github.com/leandcesar/themoviedb"
},
"split_keywords": [
"tmdb",
"tmdb3",
"aiotmdb",
"aiotmdb3",
"themoviedb",
"themoviedb3",
"sync",
"async",
"await",
"aio",
"movie",
"movies",
"tv",
"tv show",
"tv shows",
"api",
"wrapper"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "1dc764e691395600fa6f4f6006900c76b5771d5e9eb89a02d797ad8ea47ff6bc",
"md5": "f5a4f84a470005d5ffefe85533bf3c71",
"sha256": "e4c3f8fd41ab0746fd900568a58616794c01936e9a0dc03b7dbeaba25be05ae0"
},
"downloads": -1,
"filename": "themoviedb-0.4.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f5a4f84a470005d5ffefe85533bf3c71",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 59424,
"upload_time": "2023-06-18T02:23:20",
"upload_time_iso_8601": "2023-06-18T02:23:20.167514Z",
"url": "https://files.pythonhosted.org/packages/1d/c7/64e691395600fa6f4f6006900c76b5771d5e9eb89a02d797ad8ea47ff6bc/themoviedb-0.4.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f707396eabaf62eaa3d09e0ec28a486a295278a38c165bce2c9424a396b3e234",
"md5": "b86e99431d1c479ade736e4b3f6aa582",
"sha256": "d5a8f76fc9afbec0f456de278180bddc4737b8123657da88f7803f053c214692"
},
"downloads": -1,
"filename": "themoviedb-0.4.0.tar.gz",
"has_sig": false,
"md5_digest": "b86e99431d1c479ade736e4b3f6aa582",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 30795,
"upload_time": "2023-06-18T02:23:22",
"upload_time_iso_8601": "2023-06-18T02:23:22.145259Z",
"url": "https://files.pythonhosted.org/packages/f7/07/396eabaf62eaa3d09e0ec28a486a295278a38c165bce2c9424a396b3e234/themoviedb-0.4.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-06-18 02:23:22",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "leandcesar",
"github_project": "themoviedb",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "themoviedb"
}