The One API Python SDK
Installation
To install the SDK:
- Create and activate a venv
$ mkdir venv
$ python3.10 -m venv venv
$ source venv/bin/activate
- Install the package from PyPi
(venv) $ pip install the-one-api-sdk-duke
User Guide
- If you haven't done so, create an account at The One API
- Use your access token to authenticate:
>>> import the_one_api
>>> the_one_api.api_key = "your-access-token-here"
Endpoints
Movie Endpoint
Import the Movie module:
>>> from the_one_api import movie
Quotes can be listed in full, fetched by ID, or searched using a variety of filters
>>> movie.list_all()
>>> movie.get('quote-id')
>>> movie.filter(**filters)
Quote Endpoint
Import the Quote module:
>>> from the_one_api import quote
Quotes can be listed in full, fetched by ID, or searched using a variety of filters, including by movie ID.
>>> quote.list_all()
>>> quote.get('quote-id')
>>> quote.filter(movie_id="movie-id", match={"character": "character-id"}) # etc.
About Sorts and Filters
The filter functionality accepts a sort keyword argument and a variety of filters
Sort
Supply a field to sort by, and prepend a "-" for a descending sort. Only one field at a time is supported.
>>> movie.filter(sort="name")
>>> quote.filter(sort="-character")
Match/Negate Match
Supply a dictionary containing a field and value for an exact match (or to not match). Only one term per match is supported.
>>> movie.filter(match={"name": "The Lord of the Rings Series")
>>> movie.filter(negate_match={"name": "The Lord of the Rings Series")
Filter/Exclude
Supply a dictionary containing a field and a list of values to match (or not match).
>>> movie.filter(filter={"name": ["The Return of the King", "The Fellowship of the Ring"]})
>>> movie.filter(exclude={"name": ["The Return of the King", "The Fellowship of the Ring"]})
Regex/Negate Regex
Supply a MongoDB-style regex pattern to include or not. See the MongoDB documentation for details.
>>> quote.filter(regex={"dialog": "/foot/i"})
>>> quote.filter(negate_regex={"dialog": "/foot/i"})
Less Than, Greater Than, and Greater Than or Equal To
Supply a dictionary containing a field and a number or character.
>>> movie.filter(gte={"budgetInMillions": 600}, lt={"budgetInMillions": 400})
>>> quote.filter(lt={"dialog": "B"})
Developer Guide
Installation
- Clone the project from GitHub
- Create a venv and activate it
- Install the requirements and the project itself in editable mode:
(venv) $ pip install -r requirements.txt -r requirements-dev.txt
(venv) $ pip install -e .
Running the test suite
Once the project has been installed following the Developer Guide:
- Install "requirements-test.txt"
- Run the tests:
(venv) $ python -m pytest
Metadata
Release files for the-one-api-sdk-duke 0.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| the_one_api_sdk_duke-0.0.0-py3-none-any.whl | Python 3 | none | any | Details for the_one_api_sdk_duke-0.0.0-py3-none-any.whl |
Release files / the_one_api_sdk_duke-0.0.0-py3-none-any.whl
| Download URL | the_one_api_sdk_duke-0.0.0-py3-none-any.whl |
|---|---|
| Size | 9.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c456ba7eddc355b497b2091e8db4d7861eca184259cfa9d67f29ecb5a99a13be
|
|
BLAKE2b-256 checksum How to use checksums |
812a07877be94912b22436ded0f78576fb734845808f544a8031fcd28ec4eaad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.10
|
Security for the-one-api-sdk-duke 0.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.