For a while now, I’ve been thinking about building my own app to store details of my DVD collection, and have been a fan of The Open Movie Database (OMDB) which allows RESTful queries to retrieve details of movies eg. Who was the writer or what year was it released.
Before you can use OMDB, you need to have an API Key – this is created by completion of a request form on their website, with the key emailed to you. Once you have the key, you can query their database unto 1000 times per month without charge 🙂
I use Python alot for prototyping and created the following code snippet (I use Lepton to manage my code snippets), which allows a movie title to be entered, if it exists in the database, you get back a JSON object stored in a Python dictionary, so you could then use it in a larger app. If the title does not exist or the query against the database is bad, an error is printed and app execution ends.
I use the Python requests module – you may need to install this – its used to connect to the OMDB website , see here.
Here is my code, enjoy 😉
All copyrights, trademarks and other mentions are recognised as works of the original author/owner.