semvec/pypi-packages huggingface dataset:
iron_cage 0.1.0
Foundation utilities and core primitives for structured Python applications
Requires Python: >=3.12
Keywords: fundamental, general-purpose

# Module :: iron_cage

Foundation utilities and core primitives for structured Python applications

<!--
### Basic use-case

```python
from iron_cage import f1

def main():
  f1()
```

### To add to your project

```bash
uv add iron_cage
```

### Try out from the repository

```shell
git clone <repository>
cd <repository>
uv sync
uv run python -m iron_cage
```
-->

### Sample

<!-- Add usage examples here -->
ekey-bionyxpy 1.0.1
Interact with the bionyx third party API of the ekey biometric systems.
Requires Python: >=3.11

# API for the ekey bionyx system - Python

[![Lint & Test](https://github.com/richardpolzer/ekey-bionyx-api/actions/workflows/lint_test.yml/badge.svg?branch=main)](https://github.com/richardpolzer/ekey-bionyx-api/actions/workflows/lint_test.yml)
[![codecov](https://codecov.io/github/richardpolzer/ekey-bionyx-api/branch/main/graph/badge.svg?token=MXJCFJZO5I)](https://codecov.io/github/richardpolzer/ekey-bionyx-api)
[![PyPI - Version](https://img.shields.io/pypi/v/ekey-bionyxpy)](https://pypi.org/project/ekey-bionyxpy)


## Overview

The ekey_bionyxpy library can be used to interact with the API of the ekey bionyx biometric systems. All the current functions of the API are mapped. The library is written to completely take advantage of async code in Python.

---

## Features

- **Get all systems attached to the user**
- **Get all webhooks added by the integration**
- **Add new webhooks**
- **Update existing webhooks**

## Enabling the API

The system must be setup in the online mode. In your app please enable the API by following the picture
![Erklärung](https://github.com/user-attachments/assets/58602bed-af94-43a7-8bfa-aaeaa82e6cde)

After the API is enabled you can use the library by first implementing AbstractAuth with your custom token handling.

In the example a token manager is used. You can however use any mechanism you like to retieve an access token.

```python
from ekey_bionyxpy import AbstractAuth

class Auth(AbstractAuth):
    def __init__(self, websession: ClientSession, host: str, token_manager):
        """Initialize the auth."""
        super().__init__(websession, host)
        self.token_manager = token_manager

    async def async_get_access_token(self) -> str:
        """Return a valid access token."""
        if self.token_manager.is_token_valid():
            return self.token_manager.access_token

        await self.token_manager.fetch_access_token()
        await self.token_manager.save_access_token()

        return self.token_manager.access_token
```

Once the Authentication is dealt with you can use the lib like so:

```python
async def main() -> None:
    async with aiohttp.ClientSession() as session:
        # Aquire token manager here
        auth = Auth(
            session,
            "https://api.bionyx.io/3rd-party/api",
            token_manager,
        )
        api = BionyxAPI(auth)
        systems = await api.get_systems()
        webhooks = await systems[0].get_webhooks()


asyncio.run(main())
```