Skip to main content

A SDK for the-one-api.dev API

Project description

Lord of the Rings SDK

Requiriments

Python >= 3.9

Installation

To install this SDK, execute the following command in your terminal:

pip install efsspysdk

To use this SDK, you need an access token. Generate it by creating an account here.

Once you have obtained your access token, set it as an environment variable in your terminal. In the project's root folder, execute the following command:

 source ./setup-token your-token-here

Alternatively, if you prefer or encounter any issues, manually export the environment variable:

export API_KEY=your-token-here

How to use

The SDK provides two available agents: Movie for movie requests and Quote for quotes. In your code, import the desired agents from the previously installed package:

from efsspysdk import Movie, Quote

Movie agent

Regarding the Movie agent, it offers the following methods:

Method: list() Response: Retrieves a list of all movies, including "The Lord of the Rings" and "The Hobbit" trilogies. Example:

movie = Movie()
movie.list()

or

Movie().list()

Method: get(movie-id) Response: Requests information for a specific movie. Example:

movie = Movie()
movie.get(movie_id)

or

Movie().get(movie_id)

Method: list_quotes(movie-id) Response: Requests all movie quotes for a specific movie (only working for the LotR trilogy). Example:

movie = Movie()
movie.list_quotes(movie_id)

or

Movie().list_quotes(movie_id)

Quote agent

The Quote agent provides the following methods:

Method: list() Response: Retrieves a list of all movie quotes. Example:

quote = Quote()
quote.list()

or

Quote().list()

Method: get(movie-id) Response: Requests a list of all movie quotes for a specific movie. Example:

quote = Quote()
quote.get(movie-id)

or

Quote().get(movie-id)

Filters

In all methods, it is possible to filter only specific fields from the response JSON. To do this, you can include them as a list in the method call. For example:

movie.list(['name', 'academyAwardNominations', 'academyAwardWins'])

This will return a list of movies with only the three attributes listed: name, academyAwardNominations, and academyAwardWins.

example image

Specifically for certain calls:

quote.get('5cd96e05de30eff6ebccebd0', ['dialog'])

This will retrieve a specific quote with only the 'dialog' field included in the response.

example image

Using these filters allows you to retrieve specific fields of interest, providing a more focused and efficient way of working with the data.

You can execute the unit tests by running the following command in the root directory of the repository:

pytest

This command will run the unit tests and provide feedback on their success or any encountered failures.

If you want to see an example, you can execute the script example.py in the root directory of this repository by running the following command:

python example.py

I hope you have a great experience! If you have any further questions, feel free to ask. 😊

Hello LibLab!

I hope you're doing well, my friend! My name is Emmanuel, and I'm thrilled to be participating in this test to become your new DevOps Engineer. I absolutely love challenges like this, and I'm always excited to give my best shot. Unfortunately, with the limited time of 6 hours, I couldn't take care of every detail as I usually do, such as complete unit testing, improving folder structure, and validating most parameters. However, I believe this test showcases my understanding of Python and SDKs.

If you're curious to see more, feel free to check out other projects on my GitHub and my LinkedIn page, where you can explore my journey so far (links are provided below)!
Best,
See ya soon!

Linkedin GitHub

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

efsspysdk-0.0.3.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

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

efsspysdk-0.0.3-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file efsspysdk-0.0.3.tar.gz.

File metadata

  • Download URL: efsspysdk-0.0.3.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for efsspysdk-0.0.3.tar.gz
Algorithm Hash digest
SHA256 67bdba976a6e73a489eb6080b6c137cce7f11f4c7738f13735490c0a95746d8b
MD5 25072b5f76c314edbab2526af9bff1cd
BLAKE2b-256 350f3c8cdd0517ab4d38223f63d1559b6f620c9be5d51e6e5bf462fbed2f439b

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for efsspysdk-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 8b99c12d099b73550f9bb06c458bca1b8e27afbe7247eb7f9acbfb92d4d3272a
MD5 4f48e984736dbaa1ceb570b47f36c67f
BLAKE2b-256 66ca161619c3fc78e7d275c29f3dfc4e5357d298e89790da1ee25d61360db445

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