Package: owx-lotr-sdk
LOTR SDKA Python SDK forhttps://the-one-api.dev.This library provides a client for interacting with The One API, as well as
helper classes for building queries and handling errors. The main classes
areLotrClient, which sends requests to the API, andLotrQueryBuilder, which
helps construct query parameters for those requests.Example usage:from lotr_sdk import client
    from lotr_sdk import query
    from lotr_sdk import options

    # Use query builder to construct parameters for client fetch requests.
    query_builder = query.LotrQueryBuilder(models.BOOK)
    query_builder \
        .paginate(page=1, limit=10) \
        .add(query.Sort("title", SortOrder.DESCENDING))
    query = query_builder.build()

    # Create a LotrClient using your API key from https://the-one-api.dev.
    lotr_client = client.LotrClient(api_key="your_api_key")
    books = lotr_client.get_books(query)This module depends on the requests library for sending HTTP requests, and
the backoff and ratelimit libraries for handling rate limits and retries.Project ConfigurationThis project usespoetry. From thepoetrysite:Poetry is a tool for dependency management and packaging in Python. It allows you to declare the
libraries your project depends on and it will manage (install/update) them for you. Poetry offers
a lockfile to ensure repeatable installs, and can build your project for distribution.LotrQueryBuilderThelotr_sdk.querymodule contains a query parameter builder and supporting classes. Specifically,
it contains theLotrQueryBuilderclass with the following primary methods:add()takes instances ofPaginate,Sort, orFilterclasses for defining clauses in the
query. These classes can also be found in thelotr_sdk.clientmodule.build()returns the query parameters as a dictionary, ready to be used with theLotrClientinterface.LotrClientTheLotrClientclass provides methods for fetching information from [The One API](https:
//the-one-api.dev). Fetch results use types defined in thelotr_sdk.modelsmodule. The client
methods return either a single object, or a homogeneous list of objects. The following types are
supported:BookChapterMovieQuoteCharacterTestsTests use thepytestlibrary, and can be found in thetestsmodule. Assuming that you havepoetryinstalled and set up, tests can be run using:poetry run pytest tests/test_lotr_sdk.pyThe One API key is read fromTHE_ONE_API_KEYenvironment variable. It can be specified in most
shells using the following syntax:THE_ONE_API_KEY="your-api-key" poetry run pytest tests/test_lotr_sdk.pyTests are divided between the following classes:TestLotrClientUnitruns through the client methods with mocked network requests.TestLotrClientIntegrationruns through the client methods making network requests. Beware of API
rate limitations.TestLotrQueryBuilderruns through the query builder methods to create query parameter
dictionaries for all clauses.To install dependencies, runpoetry install.To run a subset of tests, use the following syntax:poetry run pytest tests/test_lotr_sdk.py::TestLotrClientUnitto run only tests in that test class.poetry run pytest tests/test_lotr_sdk.py::TestLotrClientUnit::test_get_booksto run only theget_bookstest in that test class.PublishTo install dependencies, run:poetry installTo set your PyPI token:poetry config pypi-token.pypi your-api-tokenTo build the project, run:poetry buildTo publish:poetry publishAlternatively:poetry publish --build