Metadata-Version: 2.4
Name: enappsys
Version: 0.1.0
Summary: The EnAppSys Python client provides a light-weight client that allows for simple access to EnAppSys' API services.
Author-email: Silvan Murre <silvan.murre@montel.energy>
License-Expression: MIT
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests
Provides-Extra: async
Requires-Dist: aiohttp; extra == "async"
Provides-Extra: pandas
Requires-Dist: pandas; extra == "pandas"
Provides-Extra: dev
Requires-Dist: enappsys[async]; extra == "dev"
Requires-Dist: enappsys[pandas]; extra == "dev"
Requires-Dist: pre-commit; extra == "dev"
Requires-Dist: pytest-asyncio; extra == "dev"
Requires-Dist: pytest-benchmark; extra == "dev"
Requires-Dist: pytest; extra == "dev"
Requires-Dist: ruff; extra == "dev"
Dynamic: license-file

# EnAppSys Python Client

The Python library for the [EnAppSys](https://app.enappsys.com) platform provides a light-weight Python client to interact with EnAppSys' API services. Additionally, there is an asynchronous client for non-blocking operations.

## Installation

Supports Python 3.7+.

```bash
pip install enappsys[async,pandas]
```

The extras are optional:

- `async` required for using the `EnAppSysAsync` asynchronous client.
- `pandas` required for converting API responses to DataFrames, e.g. via `client_response.to_df()`

If you only need the synchronous client and raw responses, install without extras:

```bash
pip install enappsys
```

### Configuring credentials

Your EnAppSys username and secret are required to make API requests. You can obtain these as follows:

1. Go to any download page on EnAppSys and click **Copy API URL**.
2. In the copied URL:

    - The value after `user=` is your **username**.
    - The value after `pass=` is your **secret** (a long numeric string).


The client looks for credentials in the following order:

1. **Direct arguments** when creating the client:

    ```python
    from enappsys import EnAppSys

    client = EnAppSys(
        user="example_user",
        secret="123456789123456789123456789123456789"
    )
    ```
    
2. **Environment variables**:

    ```bash
    export ENAPPSYS_USER=example_user
    export ENAPPSYS_SECRET=123456789123456789123456789123456789
    ```

3. **Credentials file** at your home directory, the default location is: `~/.credentials/enappsys.json`:

    ```json
    {
        "user": "example_user",
        "secret": "123456789123456789123456789123456789"
    }
    ```

    You can also save and specify a custom path:

    ```python
    client = EnAppSys(credentials_file="path/to/credentials.json")
    ```


### Development

Install in editable mode:

```bash
python -m pip install -e .[dev]
```

Install the commit hooks:

```bash
pre-commit install
```
