Skip to main content

Onyx Client

Buy Me A Coffee

This repository contains a Python HTTP client for Hella' s ONYX.CENTER API.


Installation

The package is published in (Test)PyPi and can be installed via:

pip install onyx-client

Configuration

The configuration defines connection properties as a dict for the application running.

Attention: make sure to read the Onyx API Access Control description to retrieve the fingerprint and access token!

Option Description
fingerprint The fingerprint of the ONYX.CENTER.
access_token The permanent access token.
/ client_session / The initialized aiohttp.ClientSession. (Default: None, create new session.)

Access Control Helper

The method onyx_client.helpers.exchange_code takes the API code and performs the exchange to a fingerprint and access token. Please follow the aforementioned documentation to retrieve the code.

Usage

You can instantiate the client using the onyx_client.create_client method like:

import aiohttp
from onyx_client import create_client
from onyx_client.helpers import exchange_code

# by providing the fingerprint and access token only
client = create_client(fingerprint="fingerprint", access_token="access_token")

# by providing the fingerprint, access token and aiohttp client session
client = create_client(fingerprint="fingerprint", access_token="access_token", client_session=aiohttp.ClientSession())

# by providing the configuration object
client_session = aiohttp.ClientSession()
# e.g. by exchanging the code first
config = exchange_code("code", client_session)
client = create_client(config=config, client_session=client_session) if client_session is not None else None

An example is shown in the examples directory.


Development

The project uses poetry and to install all dependencies and the build environment, run:

$ pip install poetry
$ poetry install

Testing

  1. Install all dependencies as shown above.
  2. Run pytest by:
$ poetry run pytest
# or
$ pytest

Linting and Code Style

The project uses flakehell as a wrapper for flake8, and black for automated code style fixing, also using pre-commit.

  1. Install all dependencies as shown above.
  2. (Optional) Install pre-commit hooks:
$ poetry run pre-commit install
  1. Run black:
$ poetry run black .
  1. Run flakehell:
$ poetry run flakehell lint

Building

This package uses poetry-dynamic-versioning which infers the version number based on the Git tags. Hence, to have a proper versioning for the distribution, use Python's build system like:

$ pip install build
$ python -m build

Your distribution will be in the dist directory.

Commit Message

This project follows Conventional Commits, and your commit message must also adhere to the additional rules outlined in .conform.yaml.


Release

To draft a release, use standard-version:

$ standard-version
# alternatively
$ npx standard-version

Finally, push with tags:

$ git push --follow-tags

Contributions

Please feel free to contribute, be it with Issues or Pull Requests! Please read the Contribution guidelines

Supporting

If you enjoy the application and want to support my efforts, please feel free to buy me a coffe. :)

Buy Me A Coffee

Metadata

Release files for onyx-client 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for onyx-client 2.0.0
File Size Uploaded Provenance Actions
onyx-client-2.0.0.tar.gz 12.5 kB Without provenance Details for onyx-client-2.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for onyx-client 2.0.0
File Interpreter ABI Platform Actions
onyx_client-2.0.0-py3-none-any.whl Python 3 none any Details for onyx_client-2.0.0-py3-none-any.whl

Total release size: 28.1 kB

Release files / onyx-client-2.0.0.tar.gz

Download URL onyx-client-2.0.0.tar.gz
Size 12.5 kB
Tags Source
SHA-256 checksum
How to use checksums
4e17df931971dd9c0347d655e5c1df2e0812dd2967cf6bf2f765492e5b10b41a
BLAKE2b-256 checksum
How to use checksums
ec4763c3ce6d7a367777bef80a361f71a76c6bf37e11c9c63e8db59fe3974c89
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

Release files / onyx_client-2.0.0-py3-none-any.whl

Download URL onyx_client-2.0.0-py3-none-any.whl
Size 15.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
64c596dccad0ae83a07ee1a53fb5d9b6c1268b7a12c7469c1227daa9a9c9abe7
BLAKE2b-256 checksum
How to use checksums
3deeba3885c4493ef27198c988478f0ab9df574e30f61e62b6a37892a8b2b7ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

Security for onyx-client 2.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.

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page