https://github.com/textbook/atmdb
Asynchronous API wrapper for TMDb (https://www.themoviedb.org/).
https://github.com/textbook/atmdb
Last synced: about 1 year ago
JSON representation
Asynchronous API wrapper for TMDb (https://www.themoviedb.org/).
- Host: GitHub
- URL: https://github.com/textbook/atmdb
- Owner: textbook
- License: isc
- Created: 2016-05-02T09:55:39.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2021-10-21T17:51:42.000Z (over 4 years ago)
- Last Synced: 2025-04-14T21:56:02.991Z (over 1 year ago)
- Language: Python
- Homepage: https://pythonhosted.org/atmdb/
- Size: 70.3 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
aTMDb
=====
.. image:: https://img.shields.io/pypi/v/atmdb.svg
:target: https://pypi.python.org/pypi/atmdb
:alt: PyPI Version
.. image:: https://travis-ci.org/textbook/atmdb.svg?branch=master
:target: https://travis-ci.org/textbook/atmdb
:alt: Travis Build Status
.. image:: https://coveralls.io/repos/github/textbook/atmdb/badge.svg?branch=master
:target: https://coveralls.io/github/textbook/atmdb?branch=master
:alt: Code Coverage
.. image:: https://www.quantifiedcode.com/api/v1/project/370d26a2062c4b148534b576ea0fc11b/badge.svg
:target: https://www.quantifiedcode.com/app/project/370d26a2062c4b148534b576ea0fc11b
:alt: Code Issues
.. image:: https://img.shields.io/badge/license-ISC-blue.svg
:target: https://github.com/textbook/atmdb/blob/master/LICENSE
:alt: ISC License
Asynchronous API wrapper for `TMDb`_.
Compatibility
-------------
aTMDb uses `asyncio`_ with the ``async`` and ``await`` syntax, so is only
compatible with Python versions 3.5 and above.
Installation
------------
``atmdb`` can be installed from `PyPI`_ using ``pip``::
pip install atmdb
Testing
-------
You can run the tests with ``python setup.py test``. To include the integration
suite, ensure that the environment variable ``TMDB_API_TOKEN`` is set to a valid
API token, and use ``--runslow`` if running ``py.test`` directly.
Usage
-----
Client
......
The core ``TMDbClient`` must be instantiated with a valid API token (see the
`API FAQ`_ for more information), either directly::
from atmdb import TMDbClient
client = TMDbClient(api_token='')
or as the ``TMDB_API_TOKEN`` environment variable::
client = TMDbClient.from_env()
You can then access the API by calling asynchronous helper methods on the
``client`` instance::
movie = await client.get_movie(550)
assert movie.title == 'Fight Club'
Any API endpoints not currently exposed via the helper methods can be accessed
by using the ``url_builder`` and ``get_data`` methods directly, for example::
url = client.url_builder('company/{company_id}', dict(company_id=508))
# ^ endpoint # ^ parameters to insert
company = await client.get_data(url)
assert company.get('name') == 'Regency Enterprises'
Note that, if you aren't using a helper method, the result is just a vanilla
dictionary.
Utilities
.........
aTMDb also exposes utilities for working with the API and models at a higher
level of abstraction, for example::
from aTMDb import TMDbClient
from aTMDb.utils import find_overlapping_actors
actors = await find_overlapping_actors(
['monty python holy grail', 'meaning of life'],
TMDbClient(api_token=''),
)
assert any(person.name == 'Eric Idle' for person in overlap)
Documentation
-------------
Additional documentation is available on `PythonHosted`_. An overview of the
project status is shown on its `dashboard`_.
.. _API FAQ:
https://www.themoviedb.org/faq/api
.. _asyncio:
http://aiohttp.readthedocs.io/
.. _dashboard:
https://atmdb-randy-campimetry.cfapps.pez.pivotal.io
.. _PyPI:
https://pypi.python.org/pypi/atmdb
.. _PythonHosted:
https://pythonhosted.org/atmdb/
.. _TMDb:
https://www.themoviedb.org/