Skip to main content

omdbapi python library.

Build Status codecov

Python wrap to get movie, series, episode data from the Open Movie Database (OMDb) api. Example build and distribution python projects - Pytools course.

Used The Open Movie Database api to build a python lib and distribution in pypi.

How to use?

IMPORTANT: Requires Python 3.7 or newer. To works with python 3.6 must install the versión 0.5.1.

Before, you must be request free the omdbapi api key here

Install the library, Python 3.7 or newer:

>>> pip install omdbapi

To works with python 3.6 must install the versión 0.5.1

>>> pip install omdbapi==0.5.1

import the library and get movie, passing api key and title as parameter, default return short plot:

>>> from omdbapi.movie_search import GetMovie

>>> movie = GetMovie(api_key='your api key')

Get all data movie json format:

>>> movie.get_movie(title='Interstellar')

{'title': 'Interstellar',
 'year': '2014',
 'rated': 'PG-13',
 'released': '07 Nov 2014',
 'runtime': '169 min',
 'genre': 'Adventure, Drama, Sci-Fi',
 'director': 'Christopher Nolan',
 'writer': 'Jonathan Nolan, Christopher Nolan',
 'actors': 'Ellen Burstyn, Matthew McConaughey, Mackenzie Foy, John Lithgow',
 'plot': "A team of explorers travel through a wormhole in space in an attempt to ensure humanity's survival.",
 'language': 'English',
 'country': 'USA, UK, Canada',
 'awards': 'Won 1 Oscar. Another 43 wins & 148 nominations.',
 'poster': 'https://m.media-amazon.com/images/M/MV5BZjdkOTU3MDktN2IxOS00OGEyLWFmMjktY2FiMmZkNWIyODZiXkEyXkFqcGdeQXVyMTMxODk2OTU@._V1_SX300.jpg',
 'ratings': [{'Source': 'Internet Movie Database', 'Value': '8.6/10'},
  {'Source': 'Rotten Tomatoes', 'Value': '72%'},
  {'Source': 'Metacritic', 'Value': '74/100'}],
 'metascore': '74',
 'imdbrating': '8.6',
 'imdbvotes': '1,569,520',
 'imdbid': 'tt0816692',
 'type': 'movie',
 'dvd': '24 May 2016',
 'boxoffice': '$188,020,017',
 'production': 'Lynda Obst Productions, Syncopy',
 'website': 'N/A'}

Or can set full plot as parameter:

>>> movie.get_movie(title='Interstellar', plot='full')
{'title': 'Interstellar',
 'year': '2014',
 'rated': 'PG-13',
 'released': '07 Nov 2014',
 'runtime': '169 min',
 'genre': 'Adventure, Drama, Sci-Fi',
 'director': 'Christopher Nolan',
 'writer': 'Jonathan Nolan, Christopher Nolan',
 'actors': 'Ellen Burstyn, Matthew McConaughey, Mackenzie Foy, John Lithgow',
 'plot': "Earth's future has been riddled by disasters, famines, and droughts. There is only one way to ensure mankind's survival: Interstellar travel. A newly discovered wormhole in the far reaches of our solar system allows a team of astronauts to go where no man has gone before, a planet that may have the right environment to sustain human life.",
 'language': 'English',
 'country': 'USA, UK, Canada',
 'awards': 'Won 1 Oscar. Another 43 wins & 148 nominations.',
 'poster': 'https://m.media-amazon.com/images/M/MV5BZjdkOTU3MDktN2IxOS00OGEyLWFmMjktY2FiMmZkNWIyODZiXkEyXkFqcGdeQXVyMTMxODk2OTU@._V1_SX300.jpg',
 'ratings': [{'Source': 'Internet Movie Database', 'Value': '8.6/10'},
  {'Source': 'Rotten Tomatoes', 'Value': '72%'},
  {'Source': 'Metacritic', 'Value': '74/100'}],
 'metascore': '74',
 'imdbrating': '8.6',
 'imdbvotes': '1,569,520',
 'imdbid': 'tt0816692',
 'type': 'movie',
 'dvd': '24 May 2016',
 'boxoffice': '$188,020,017',
 'production': 'Lynda Obst Productions, Syncopy',
 'website': 'N/A'}

Get value using class attributes:

>>> movie.director
'Christopher Nolan'

>>> movie.poster
'https://m.media-amazon.com/images/M/MV5BZjdkOTU3MDktN2IxOS00OGEyLWFmMjktY2FiMmZkNWIyODZiXkEyXkFqcGdeQXVyMTMxODk2OTU@._V1_SX300.jpg'

>>> movie.awards
'Won 1 Oscar. Another 43 wins & 148 nominations.'

Get values using keys as parameter:

>>> movie.get_data('director', 'actors', 'awards', 'plot')

{'director': 'Christopher Nolan',
 'actors': 'Ellen Burstyn, Matthew McConaughey, Mackenzie Foy, John Lithgow',
 'awards': 'Won 1 Oscar. Another 43 wins & 148 nominations.',
 'plot': "A team of explorers travel through a wormhole in space in an attempt to ensure humanity's survival."}

Release files for omdbapi 0.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for omdbapi 0.7.0
File Size Uploaded
omdbapi-0.7.0.tar.gz 17.7 kB Details

Release files / omdbapi-0.7.0.tar.gz

Download URL omdbapi-0.7.0.tar.gz
Size 17.7 kB
Tags Source
SHA-256 checksum
How to use checksums
e1f66ba4dd1ebc7a9da1c12d8e040e2fdf48c8004fe1a463bffb880447227608
BLAKE2b-256 checksum
How to use checksums
5a119758e6def996fa3793daa9cac975b134b55ecd1ece141a8f4b69031b288e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.7

Release history Release notifications | RSS feed

This release

0.7.0 This release

1 release file

0.6.0

1 release file

0.5.4

1 release file

0.5.3

1 release file

0.5.2

1 release file

0.5.1

1 release file

0.5

1 release file

0.4

1 release file

0.3

1 release file

0.2

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page