Skip to main content

lotR SDK for movies and quotes

Project description

Lord of the Rings SDK

Author: Nathanial Hapeman

Simple SDK for exploring 2 endpoints from the-one-api:

  • LotR movies
    • Supports fetching by id
  • LotR quotes
    • Supports fetching quotes by id
  • LotR movie quotes
    • Supports fetching quotes by movie id

All LotR sdk functions support limit and offset.

The data pulled from the external api will be loaded into pydantic models which have the added benefit of validating the data and being easy to declare.

Installation

Using python>=3.9: pip install nrh-lotr

Usage

# First grab an api key from: https://the-one-api.dev/documentation#3
# Then put it in an env var like: `export API_KEY=SOME_API_KEY`
# Or insert it directly into the LOTR class as depicted below
from lotr import LOTR, Movie, Quote

# Movie basics.
lotr = LOTR("YOUR_API_KEY")
# lotr = LOTR() # if using env var
movies = lotr.movies(limit=5)
assert len(movies) == 5
movie_3 = movies[3]
assert lotr.movies(id=movie_3.id)[0] == movie_3

# Quote basics.
lotr = LOTR()
quotes = lotr.quotes(limit=7)
assert len(quotes) == 7
quote_6 = quotes[6]
assert lotr.quotes(id=quote_6.id)[0] == quote_6

# Movie quotes (only works on original 3).
lotr = LOTR()
all_movies = lotr.movies()
two_towers = next(m for m in all_movies if m.name == "The Two Towers")
movie_quotes = lotr.movie_quotes(id=two_towers.id, limit=11)
assert len(movie_quotes) == 11
assert all(isinstance(q, Quote) for q in movie_quotes)

Developing from source? Install like:

python3 -m venv lotr
source ./lotr/bin/activate
python -m pip install -e .

Original Prompt

Create these endpoints:

  • /movie
  • /movie/{id}
  • /movie/{id}/{quote}
  • /quote
  • /quote/{id}

Deploy to package manager like: npm, pip, maven, etc...

Fill out design.md

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

nrh-lotr-0.0.3.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

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

nrh_lotr-0.0.3-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file nrh-lotr-0.0.3.tar.gz.

File metadata

  • Download URL: nrh-lotr-0.0.3.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for nrh-lotr-0.0.3.tar.gz
Algorithm Hash digest
SHA256 f2118bead7ec2d071db09782def453c7cb87b5d2887e2a2103d1b43cea15917f
MD5 c90eb8a0356f5ddd5475ed79d2fd8243
BLAKE2b-256 f1c7caf0c60253143dbed59dd58868b689728a78937c4a35fb806b830d3fd4a8

See more details on using hashes here.

File details

Details for the file nrh_lotr-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: nrh_lotr-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for nrh_lotr-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e757f317dcc6a5ee76f635ef4af6c6e6199b98079094b779601b856ec56401d1
MD5 4fcc86d6dee335d6107ba888e2437776
BLAKE2b-256 32b842051c1429a5269ab67f68fd062cb24433fc46b55e6c4cbb27ff798e448f

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