Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lotr_ryankubin-0.1.1.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lotr_ryankubin-0.1.1-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file lotr_ryankubin-0.1.1.tar.gz.

File metadata

  • Download URL: lotr_ryankubin-0.1.1.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.6

File hashes

Hashes for lotr_ryankubin-0.1.1.tar.gz
Algorithm Hash digest
SHA256 be1e43152823cb5156034e761153788a422790fae8224aa2100a2d73eea5d4f9
MD5 fdb3bfed565d8a5f960ec71ba6a9d5aa
BLAKE2b-256 16f7094d36598d78a60b15f9ffacc359f0a459395ed52cdcafcec02d38ba2779

See more details on using hashes here.

File details

Details for the file lotr_ryankubin-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: lotr_ryankubin-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.6

File hashes

Hashes for lotr_ryankubin-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a4d040756a19f51fd7e5a93b231723de21eac54645cd87cb89a5ae1132519af4
MD5 b8a6c4e1b85bdb981201e95df7621135
BLAKE2b-256 b988daf64626b8f1c0653124ee296d71dedbd74059788c47c467bd84c4049eb2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page