Skip to main content

API client for MyApiMovies

Project description

MyApiMovies API Client

This client facilitates MyApiMovies API calls. You only need a token that you can obtain by registering here

Init the client

Initialize the class MyApiMovies with your token

from myapimovies import MyApiMovies

client = MyApiMovies('<TOKEN>')

Examples

Getting movie by id

from myapimovies import MyApiMovies

client = MyApiMovies('<TOKEN>')

IMDB_ID_AVENGERS_ENDGAME = 'tt4154796'

response = client.movie(imdb_id=IMDB_ID_AVENGERS_ENDGAME)
first_result = response.data[0]

print(f'ImdbId: {first_result.imdbId}')
print(f'Title: {first_result.title}')
print(f'Year: {first_result.year}')
print(f'Poster: {first_result.posterUrl}')

Search movie

from myapimovies import MyApiMovies

client = MyApiMovies('<TOKEN>')

title = 'Yesterday'
year = 2019

response = client.movie_search(title=title, year=year)
first_result = response.data[0]

print(f'ImdbId: {first_result.imdbId}')
print(f'Title: {first_result.title}')
print(f'Year: {first_result.year}')
print(f'Poster: {first_result.posterUrl}')

Similar movies

from myapimovies import MyApiMovies

client = MyApiMovies('<TOKEN>')

IMDB_ID_AVENGERS_ENDGAME = 'tt4154796'

response = client.similar_movies(imdb_id=IMDB_ID_AVENGERS_ENDGAME)
first_result = response.data[0]

print(f'ImdbId: {first_result.imdbId}')
print(f'Title: {first_result.title}')
print(f'Year: {first_result.year}')
print(f'Poster: {first_result.posterUrl}')

Several data at the same time about a movie

from myapimovies import MyApiMovies

client = MyApiMovies('<TOKEN>')

args = {
    'imdbId': 'tt0133093',
    'actors': 'main==true;page==1',
    'akas': ''
}

response = client.movie_all_in_one(args=args)
first_result = response.data[0]

actors_first_result = first_result.actors.data[0]

print(f'Character: {actors_first_result.character}')
print(f'Character url: {actors_first_result.characterUrl}')
print(f'Main: {actors_first_result.main}')

aka_first_result = first_result.akas.data[0]

print(f'Title: {aka_first_result.title}')
print(f'Country: {aka_first_result.country.country}')

movie_first_result = first_result.movie.data

print(f'ImdbId: {movie_first_result.imdbId}')
print(f'Title: {movie_first_result.title}')
print(f'Year: {movie_first_result.year}')
print(f'Poster: {movie_first_result.posterUrl}')

Search person

from myapimovies import MyApiMovies

client = MyApiMovies('<TOKEN>')

IMDB_ID_JIM_PARSONS = 'nm1433588'

response = client.name(imdb_id=IMDB_ID_JIM_PARSONS)
first_result = response.data[0]

print(f'ImdbId: {first_result.imdbId}')
print(f'Actor: {first_result.actorActress}')
print(f'Biography: {first_result.biography}')
print(f'Photo: {first_result.photoUrl}')

Several data at the same time about a person

from myapimovies import MyApiMovies

client = MyApiMovies('<TOKEN>')

IMDB_ID_JIM_PARSONS = 'nm1433588'

args = {
    'imdbId': IMDB_ID_JIM_PARSONS,
    'alternative': ''
}

response = client.name_all_in_one(args=args)
first_result = response.data[0]

name_first_result = first_result.name.data

print(f'ImdbId: {name_first_result.imdbId}')
print(f'Actor: {name_first_result.actorActress}')
print(f'Biography: {name_first_result.biography}')
print(f'Photo: {name_first_result.photoUrl}')

alternative_not_found = first_result.alternative

# No alternate name
print(f'Code: {alternative_not_found.code}')
print(f'Error: {alternative_not_found.error}')

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

myapimovies-0.0.3.tar.gz (23.7 kB view hashes)

Uploaded Source

Built Distribution

myapimovies-0.0.3-py3-none-any.whl (17.3 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