Skip to main content

Asyncronous and synchronous Python client for OMDb (the Open Movie Database)

Project description

aio-omdb

Asyncronous and synchronous Python clients for OMDb (the Open Movie Database).

Usage

from aio_omdb.client import AsyncOMDBClient, SyncOMDBClient

OMDB_API_KEY = '...'  # Get your key from OMDB

a_client = AsyncOMDBClient(api_key=OMDB_API_KEY)
s_client = SyncOMDBClient(api_key=OMDB_API_KEY)

# Client provides the following methods:

# Get by IMDB ID
await a_client.get_by_id('tt1000252')
s_client.get_by_id('tt1000252')

# Get by exact title
await a_client.get_by_id('Rome, open city')
s_client.get_by_id('Rome, open city')

# Search title by a word or phrase
await a_client.search('Spock')
s_client.search('Spock')

The following exceptions may be raised:

  • aio_omdb.exc.InvalidAPIKey: if an invalid API key is used;
  • aio_omdb.exc.MovieNotFound: if no movie can be found in get_by_id or get_by_title.

Testing

  1. Install the testing extras
pip install -Ue .[testing]
  1. Create file .env in the project root and put your OMDb API key there:
OMDB_API_KEY=<your API key>
  1. Run tests
make test

Enjoy!

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

aio-omdb-0.0.2.tar.gz (5.7 kB view hashes)

Uploaded Source

Built Distribution

aio_omdb-0.0.2-py3-none-any.whl (5.5 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