SDK for interacting with the Lord of the Rings API
Project description
Lord of the Rings SDK
The Lord of the Rings SDK is a Python package that provides easy access to the Lord of the Rings API. It includes modules for interacting with the movies and quotes from the Lord of the Rings movies.
Installation
To get started, you'll need to install the dr-lord-of-the-rings-sdk package.
pip install dr-lord-of-the-rings-sdk
Importing the SDK
You can import the Lord of the Rings SDK in your Python project using the following import statement:
from lotr_sdk.movies import Movie
from lotr_sdk.quotes import Quote
This will allow you to use the Movie, and Quote classes from the SDK in your code.
Usage
Here are some basic examples of how to use the Lord of the Rings SDK:
from lotr_sdk.movies import Movie
from lotr_sdk.quotes import Quote
# Get the Quote object with the specified ID
quote_id = Quote.get(id='5cd96e05de30eff6ebcce814')
# Check if a Quote object was found and print its details
if quote_id:
print("Dialog:", quote_id.dialog)
print("Movie ID:", quote_id._movie)
# Call the movie property to get the associated movie object
movie = quote_id.movie
if movie:
print("Movie Title:", movie.name)
print("Movie ID:", movie._id)
else:
print("Movie not found.")
else:
print("Quote not found.")
# Get a Movie object with the specified ID
movie_id = Movie.get(_id='5cd95395de30eff6ebccde5d')
# Check if a Movie object was found
if movie_id:
# Call the quotes property to get all quotes for the movie
quotes = movie_id.quotes
if quotes:
for quote in quotes:
print("Dialog:", quote['dialog'])
else:
print("No quotes found for Movie:", movie_id.name)
else:
print("Movie not found.")
# Get all the movies
movies = Movie.get()
for movie in movies:
print(movie['name'])
print("Runtime in minutes: " + str(movie['runtimeInMinutes']))
print("Budget in millions: " + str(movie['budgetInMillions']))
print()
# Get specific movies
print(movies[1])
print()
print(movies[1]['name'])
print()
# Get all the quotes
quotes = Quote.get()
for quote in quotes:
print(quote)
print()
# Get specific quote
print(quotes[8])
print()
print(quotes[1]['dialog'])
print()
# Get a specific quote by id
quote_id = Quote.get(id='5cd96e05de30eff6ebcce814')
print(quote_id.dialog)
print()
# Get information about a specific movie by id
movie_id = Movie.get(_id="5cd95395de30eff6ebccde5d")
print(movie_id.name)
print()
#Get specific quote from movie by movie id
movie_quote = Quote.get(movie=movie_id._id)
print(movie_quote[3]['dialog'])
Endpoints
The SDK interacts with the following endpoints:
-
/movies
: This endpoint returns a list of all the movies from the Lord of the Rings series. -
/movies/<id>
: This endpoint returns information about a specific movie, identified by the id parameter. -
/movie/<id>/quotes
: This endpoint returns a list of all the quotes from a specific movie, identified by the id parameter. -
/movie/<id>/quotes/<id>
: This endpoint returns a specific quote from a specific movie, identified by the id parameter. -
/quotes
: This endpoint returns a list of all the quotes from the Lord of the Rings movies. -
/quotes/<id>
: This endpoint returns information about a specific quote, identified by the id parameter.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for dr-lord-of-the-rings-sdk-0.0.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | bea340288cf17e3469b3c16ad527bbbbd5e8c7834c50990444e32f8d909cd898 |
|
MD5 | 664e5f16146ac6eea17b16c8b514f31c |
|
BLAKE2b-256 | d919de93eacc680aabeb7fcdc534eeaf00b73f5d34bfbe26ae1a20231fc567dd |
Hashes for dr_lord_of_the_rings_sdk-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 19ff9cf68e2200bff263387a76b9454fd021d317b5a10aa7e2fb290050c92bdc |
|
MD5 | 3c2b92048e8712fea18107b67c2c8ec5 |
|
BLAKE2b-256 | f324f8afe2e1d6627d7ad5f350ba4c85906a1ac24601c9749a1a73e7e332ca36 |