This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Asynchronous API wrapper for TMDb (https://www.themoviedb.org/).

Project Description

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='<insert your token here>')

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='<insert your token here>'),
)
assert any(person.name == 'Eric Idle' for person in overlap)

Documentation

Additional documentation is available on PythonHosted.

Release History

Release History

This version
History Node

0.2.3

History Node

0.2.2

History Node

0.2.1

History Node

0.2.0

History Node

0.1.3

History Node

0.1.2

History Node

0.1.1

History Node

0.1.0

History Node

0.0.6

History Node

0.0.5

History Node

0.0.4

History Node

0.0.3

History Node

0.0.2

History Node

0.0.1

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
atmdb-0.2.3-py3-none-any.whl (12.6 kB) Copy SHA256 Checksum SHA256 py3 Wheel Sep 24, 2016
atmdb-0.2.3.tar.gz (9.4 kB) Copy SHA256 Checksum SHA256 Source Sep 24, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting