Skip to main content

SDK for the lord of the rings API

Project description

LordOfTheRings SDK

Installation

pip install lord_of_the_rings

Usage

  1. Import the LordOfTheRings class
from lordoftherings import LordOfTheRings
  1. Initialize the class with your API Token
api = LordOfTheRings('YOUR API TOKEN')
  1. Make calls to the API
  • /movie
all_movies = api.movies().get_all().fetch()
  • /movie/{id}
movie = api.movies("5cd95395de30eff6ebccde56").get()
  • /movie/{id}/quote
movie_quotes = api.movies("5cd95395de30eff6ebccde5b").quotes.get_all().fetch()
  • /quote
quotes = api.quotes().get_all().fetch()
  • /quote/{id}
single_quote = api.quotes("5cd96e05de30eff6ebccebc9").get()
  1. Make calls using sorting, filtering, and pagination
  • Filtering
match = api.movies().get_all().filter_by(name='The Lord of the Rings Series').fetch() 
negate_match = api.movies().get_all().filter_by(name=('not', 'The Lord of the Rings Series')).fetch() 
include = api.movies().get_all().filter_by(name=['The Lord of the Rings Series', 'The Desolation of Smaug']).fetch()
exclude = api.movies().get_all().filter_by(name=[('not', 'The Lord of the Rings Series'), ('not', 'The Desolation of Smaug')]).fetch()
less_than = api.movies().get_all().filter_by(budgetInMillions=('<', 100)).fetch() 
greater_than = api.movies().get_all().filter_by(runtimeInMinutes=('>', 160)).fetch()
  • Sorting
sorted_movies = api.movies().get_all().sort_by("name:asc").fetch()
  • Pagination
paged_movies_1 = api.movies().get_all().limit(2).fetch()
paged_movies_2 = api.movies().get_all().limit(3).page(2).fetch()
paged_movies_3 = api.movies().get_all().limit(1).page(1).offset(1).fetch()
  • Combine all Three
filter_sorted_paged = api.movies().get_all().limit(5).filter_by(name=('not', 'The Lord of the Rings Series')).sort_by('name:asc').fetch()

Testing

  1. Unit Tests

There is a file called test_lordoftherings.py in the tests folder that has some unit tests in it. Run this file to run the tests

  • Replace with your token
    self.auth_token = 'YOUR API TOKEN'
    
  1. Example Usage File

There is a file called test_usage.py in the tests that has many examples of how you can use this SDK. Add your auth token and uncomment the examples you want to run, then run the file.

  • Replace with your token
    api = LordOfTheRings('YOUR API TOKEN')
    

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

AaronBlaser-SDK-1.0.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

AaronBlaser_SDK-1.0-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file AaronBlaser-SDK-1.0.tar.gz.

File metadata

  • Download URL: AaronBlaser-SDK-1.0.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for AaronBlaser-SDK-1.0.tar.gz
Algorithm Hash digest
SHA256 39020ea1ba3d995b2faf458a9048cdc65a85177f092952c875bc909f30b48752
MD5 a436cb5148151874b78e7b1114b250b2
BLAKE2b-256 7c4d7818581693d60b22b3eb4f2e24e0f0879c20a97a96c963b61f3e00a70d5a

See more details on using hashes here.

File details

Details for the file AaronBlaser_SDK-1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for AaronBlaser_SDK-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 03fbcf0874282962303de70046ebf79d57796d9d834c8ed31b02488e4967f714
MD5 dfb312c93c8dcf845107a4a67841b5bb
BLAKE2b-256 fe7c6c6f1f60f2a52f32419a67e94a19e98d79a6f27951edadad93035e89e1b2

See more details on using hashes here.

Supported by

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