SDK for a lotr API
Project description
LOTR SDK
If you've ever wanted to have every piece of dialogue from every lord of the rings movie at your fingertips, boy do I have the SDK for you. With this package, you'll be able to access information on all 6 (yes, even the hobbit trilogy) movies, and every quote therein.
Prerequisites
You'll need python 3 installed.
Setup and Installation
To get started, you'll need to install the lotr_ryankubin package
pip install lotr_ryankubin
How to use it
The key to the whole interaction is to create a Lotr
object. You'll need to initialize this with your access token, which you can obtain by registering here.
Once you have your token, initialize your connection
from lotr_ryankubin.lotr import Lotr
l = Lotr(access_token='your_token_here')
If there is any issue authenticating, this will raise an unauthorized error, and you'll need to check your token to confirm it is correct.
From here, you now have access to the two main functions: movies and quotes. When you call a get, the return for all will be in JSON. Both are able to apply filters and sorts, in the format: Sort:
sort=<field_name>
direction = asc|dsc
Filter:
movie_filter=<fieldname><filterlogic>
Where filterlogic can be a regular expression, a comparison, existance, etc. Review the docs above to see the different formats and available options.
To fetch all movies:
m = l.movie()
m.get_movies()
To fetch movies with an academy award:
fancy_m = l.movie(movie_filter='academyAwardWins>0')
fancy_m.get_movies()
To fetch all quotes:
q = l.quote(movie_id=<movie_id>)
q.get_quotes()
Quotes are paginated by default, you can iterate through them by next(), previous(), or setting the limit or offset manually on the quote object
q.next()
q.previous()
q.limit = 100
q.next()
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 lotr_ryankubin-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a4d040756a19f51fd7e5a93b231723de21eac54645cd87cb89a5ae1132519af4 |
|
MD5 | b8a6c4e1b85bdb981201e95df7621135 |
|
BLAKE2b-256 | b988daf64626b8f1c0653124ee296d71dedbd74059788c47c467bd84c4049eb2 |