Name | ezapi-tmdb JSON |
Version |
0.8.4
JSON |
| download |
home_page | |
Summary | A Python wrapper for TMDb API |
upload_time | 2024-02-06 06:05:12 |
maintainer | |
docs_url | None |
author | |
requires_python | >=3.8 |
license | |
keywords |
tmdb
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
<div align="center">
<img src="https://www.themoviedb.org/assets/2/v4/logos/v2/blue_square_2-d537fb228cf3ded904ef09b136fe3fec72548ebc1fea3fbbd1ad9e36364db38b.svg" alt="yelp" height="96">
</div>
# ezapi-tmdb
[![pytest](https://github.com/zehengl/ezapi-tmdb/actions/workflows/pytest.yml/badge.svg)](https://github.com/zehengl/ezapi-tmdb/actions/workflows/pytest.yml)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)
![all-contributors](https://img.shields.io/github/all-contributors/zehengl/ezapi-tmdb)
![PyPI - License](https://img.shields.io/pypi/l/ezapi-tmdb.svg)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/ezapi-tmdb.svg)
![PyPI - Wheel](https://img.shields.io/pypi/wheel/ezapi-tmdb)
[![Downloads](https://static.pepy.tech/badge/ezapi-tmdb)](https://pepy.tech/project/ezapi-tmdb)
[![GitHub Pages](https://github.com/zehengl/ezapi-tmdb/actions/workflows/gh-deploy.yml/badge.svg)](https://github.com/zehengl/ezapi-tmdb/actions/workflows/gh-deploy.yml)
A Python wrapper for TMDb API, supporting version [3](https://developers.themoviedb.org/3/getting-started) and [4](https://developers.themoviedb.org/4/getting-started)
## Install
From [PyPi](https://pypi.org/project/ezapi-tmdb/)
pip install ezapi-tmdb
From [GitHub](https://github.com/zehengl/ezapi-tmdb)
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](https://developers.themoviedb.org/3/getting-started) for detailed API usage.
```python
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](https://developers.themoviedb.org/4/getting-started) for detailed API usage.
```python
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
```bash
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
- Icon from [www.themoviedb.org][1]
[1]: https://www.themoviedb.org/about/logos-attribution
## Contributors ✨
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
<tbody>
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Cologler"><img src="https://avatars.githubusercontent.com/u/10906962?v=4?s=100" width="100px;" alt="Cologler"/><br /><sub><b>Cologler</b></sub></a><br /><a href="https://github.com/zehengl/ezapi-tmdb/commits?author=Cologler" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/rafaelpierre"><img src="https://avatars.githubusercontent.com/u/13171938?v=4?s=100" width="100px;" alt="Rafael Pierre"/><br /><sub><b>Rafael Pierre</b></sub></a><br /><a href="https://github.com/zehengl/ezapi-tmdb/commits?author=rafaelpierre" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/joselimajr"><img src="https://avatars.githubusercontent.com/u/3194122?v=4?s=100" width="100px;" alt="joselimajr"/><br /><sub><b>joselimajr</b></sub></a><br /><a href="#ideas-joselimajr" title="Ideas, Planning, & Feedback">🤔</a></td>
</tr>
</tbody>
</table>
<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->
<!-- ALL-CONTRIBUTORS-LIST:END -->
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
Raw data
{
"_id": null,
"home_page": "",
"name": "ezapi-tmdb",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "Zeheng Li <imzehengl@gmail.com>",
"keywords": "TMDb",
"author": "",
"author_email": "Zeheng Li <imzehengl@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/80/a5/64745d97a9604a5e5d87e1409e80e28e7c09de2aa8381dfc5f990eb3d957/ezapi-tmdb-0.8.4.tar.gz",
"platform": null,
"description": "<div align=\"center\">\n <img src=\"https://www.themoviedb.org/assets/2/v4/logos/v2/blue_square_2-d537fb228cf3ded904ef09b136fe3fec72548ebc1fea3fbbd1ad9e36364db38b.svg\" alt=\"yelp\" height=\"96\">\n</div>\n\n# ezapi-tmdb\n\n[![pytest](https://github.com/zehengl/ezapi-tmdb/actions/workflows/pytest.yml/badge.svg)](https://github.com/zehengl/ezapi-tmdb/actions/workflows/pytest.yml)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)\n![all-contributors](https://img.shields.io/github/all-contributors/zehengl/ezapi-tmdb)\n![PyPI - License](https://img.shields.io/pypi/l/ezapi-tmdb.svg)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/ezapi-tmdb.svg)\n![PyPI - Wheel](https://img.shields.io/pypi/wheel/ezapi-tmdb)\n[![Downloads](https://static.pepy.tech/badge/ezapi-tmdb)](https://pepy.tech/project/ezapi-tmdb)\n[![GitHub Pages](https://github.com/zehengl/ezapi-tmdb/actions/workflows/gh-deploy.yml/badge.svg)](https://github.com/zehengl/ezapi-tmdb/actions/workflows/gh-deploy.yml)\n\nA Python wrapper for TMDb API, supporting version [3](https://developers.themoviedb.org/3/getting-started) and [4](https://developers.themoviedb.org/4/getting-started)\n\n## Install\n\nFrom [PyPi](https://pypi.org/project/ezapi-tmdb/)\n\n pip install ezapi-tmdb\n\nFrom [GitHub](https://github.com/zehengl/ezapi-tmdb)\n\n pip install git+https://github.com/zehengl/ezapi-tmdb.git\n\n## Usage\n\n1. All endpoints are mapped to functions in a `TMDb` object\n2. All query string params are used as keyword arguments\n\n### Version 3 Example\n\nSee [Version 3 documents](https://developers.themoviedb.org/3/getting-started) for detailed API usage.\n\n```python\nfrom tmdb import TMDb3\n\napi_key = \"...\"\n\ntmdb = TMDb3(api_key)\n\n# query string params are used as keyword arguments\nprint(tmdb.get_popular_movies(region=\"US\"))\nprint(tmdb.get_tvs_on_the_air(page=10))\n\n# create session_id with username/password login\nusername = \"...\"\npassword = \"...\"\nrequest_token = tmdb.create_request_token().get(\"request_token\")\ntmdb.create_session_with_login(username, password, request_token)\nsession_id = tmdb.create_session(request_token).get(\"session_id\")\n\n# some endpoints require session_id\nprint(tmdb.get_account_details(session_id=session_id))\n\n# store global options, language / region for example\ntmdb.set_options(language=\"de\", region=\"de\")\ntmdb.get_trending(\"all\", \"week\")\n\n# reset global options\ntmdb.reset_options()\n\n# configure image languages globally\ntmdb.set_options(include_image_language=[\"en\", \"null\"])\ntmdb.get_movie_images(597)\n\n# url param per request would overwrite global options\ntmdb.get_movie_images(597, include_image_language=[\"de\", \"fr\"])\n```\n\n### Version 4 Example\n\nSee [Version 4 documents](https://developers.themoviedb.org/4/getting-started) for detailed API usage.\n\n```python\nfrom tmdb import TMDb4\n\n# API Read Access Token from the settings page\naccess_token = \"...\"\n\ntmdb = TMDb4(access_token)\n\n# create a user access token\nrequest_token = tmdb.create_request_token().get(\"request_token\")\nprint(f\"https://www.themoviedb.org/auth/access?request_token={request_token}\")\n\n# click on the link above, sign in, then approve access\nresp = tmdb.create_access_token(request_token)\n\n# extract the user access token and account id for v4 api\nuser_access_token = resp.get(\"access_token\")\naccount_id = resp.get(\"account_id\")\n\ntmdb.update_access_token(user_access_token)\n\ntmdb.get_list(14105)\ntmdb.get_account_favorite_movies(account_id)\n```\n\n## Test\n\n```bash\ngit clone git@github.com:zehengl/ezapi-tmdb.git\ncd ezapi-tmdb\nexport tmdb_api_key=\"...\"\nexport tmdb_username=\"...\"\nexport tmdb_password=\"...\"\nexport tmdb_access_token=\"...\"\npython -m venv .venv\nsource .venv/bin/activate\npip install -e .\npip install -r requirements-test.txt\npytest\n```\n\nUse `$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.\n\n## Credits\n\n- Icon from [www.themoviedb.org][1]\n\n[1]: https://www.themoviedb.org/about/logos-attribution\n\n## Contributors \u2728\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->\n<!-- prettier-ignore-start -->\n<!-- markdownlint-disable -->\n<table>\n <tbody>\n <tr>\n <td align=\"center\" valign=\"top\" width=\"14.28%\"><a href=\"https://github.com/Cologler\"><img src=\"https://avatars.githubusercontent.com/u/10906962?v=4?s=100\" width=\"100px;\" alt=\"Cologler\"/><br /><sub><b>Cologler</b></sub></a><br /><a href=\"https://github.com/zehengl/ezapi-tmdb/commits?author=Cologler\" title=\"Code\">\ud83d\udcbb</a></td>\n <td align=\"center\" valign=\"top\" width=\"14.28%\"><a href=\"https://github.com/rafaelpierre\"><img src=\"https://avatars.githubusercontent.com/u/13171938?v=4?s=100\" width=\"100px;\" alt=\"Rafael Pierre\"/><br /><sub><b>Rafael Pierre</b></sub></a><br /><a href=\"https://github.com/zehengl/ezapi-tmdb/commits?author=rafaelpierre\" title=\"Code\">\ud83d\udcbb</a></td>\n <td align=\"center\" valign=\"top\" width=\"14.28%\"><a href=\"https://github.com/joselimajr\"><img src=\"https://avatars.githubusercontent.com/u/3194122?v=4?s=100\" width=\"100px;\" alt=\"joselimajr\"/><br /><sub><b>joselimajr</b></sub></a><br /><a href=\"#ideas-joselimajr\" title=\"Ideas, Planning, & Feedback\">\ud83e\udd14</a></td>\n </tr>\n </tbody>\n</table>\n\n<!-- markdownlint-restore -->\n<!-- prettier-ignore-end -->\n\n<!-- ALL-CONTRIBUTORS-LIST:END -->\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!\n",
"bugtrack_url": null,
"license": "",
"summary": "A Python wrapper for TMDb API",
"version": "0.8.4",
"project_urls": {
"homepage": "https://zehengl.github.io/ezapi-tmdb/",
"repository": "https://github.com/zehengl/ezapi-tmdb"
},
"split_keywords": [
"tmdb"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "4cfd790192c40f24c244a87fe1058bcdfb52bd2f896536670d57a3a196d27fd8",
"md5": "594541b96673cb923c8cc309fd796d37",
"sha256": "bd5f36683a14d02931cce11a8af67bf8c8c0d0398a14d187d86d7f7fc10c5fed"
},
"downloads": -1,
"filename": "ezapi_tmdb-0.8.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "594541b96673cb923c8cc309fd796d37",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 19954,
"upload_time": "2024-02-06T06:05:10",
"upload_time_iso_8601": "2024-02-06T06:05:10.986941Z",
"url": "https://files.pythonhosted.org/packages/4c/fd/790192c40f24c244a87fe1058bcdfb52bd2f896536670d57a3a196d27fd8/ezapi_tmdb-0.8.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "80a564745d97a9604a5e5d87e1409e80e28e7c09de2aa8381dfc5f990eb3d957",
"md5": "cd5ef4739bc85239400698afba4330c2",
"sha256": "4bc85e7604067ee4db34890b5a1819e9ef707b300c68e4868a3ac00c545cf7b2"
},
"downloads": -1,
"filename": "ezapi-tmdb-0.8.4.tar.gz",
"has_sig": false,
"md5_digest": "cd5ef4739bc85239400698afba4330c2",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 20415,
"upload_time": "2024-02-06T06:05:12",
"upload_time_iso_8601": "2024-02-06T06:05:12.887333Z",
"url": "https://files.pythonhosted.org/packages/80/a5/64745d97a9604a5e5d87e1409e80e28e7c09de2aa8381dfc5f990eb3d957/ezapi-tmdb-0.8.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-06 06:05:12",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "zehengl",
"github_project": "ezapi-tmdb",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "ezapi-tmdb"
}