A Python wrapper for the EVNEX Cloud API
Project description
python-evnex
Python client for the Evnex API.
Author not affiliated with Evnex.
Features
- Talks to your Evnex charger via Cloud API
- Automatic retries with exponential backoff
- Automatic re-authentication
- Optionally pass in a
httpx
client - Optionally pass in tokens to resume existing session
Installation
pip install evnex
Usage
import asyncio
from pydantic import SecretStr
from pydantic_settings import BaseSettings
from evnex.api import Evnex
class EvnexAuthDetails(BaseSettings):
EVNEX_CLIENT_USERNAME: str
EVNEX_CLIENT_PASSWORD: SecretStr
async def main():
creds = EvnexAuthDetails()
evnex = Evnex(username=creds.EVNEX_CLIENT_USERNAME,
password=creds.EVNEX_CLIENT_PASSWORD.get_secret_value())
user_data = await evnex.get_user_detail()
for org in user_data.organisations:
print("Getting 7 day insight for", org.name, "User:", user_data.name)
insights = await evnex.get_org_insight(days=7, org_id=org.id)
for segment in insights:
print(segment)
if __name__ == '__main__':
asyncio.run(main())
Examples
python-evnex
is intended as a library, but a few example scripts are provided in the examples
folder.
Providing authentication for the examples is via environment variables, e.g. on nix systems:
export EVNEX_CLIENT_USERNAME=you@example.com
export EVNEX_CLIENT_PASSWORD=<your password>
python -m examples.get_charge_point_detail
Developer Notes
Making a new release
What ends up on PyPi is what really matters. Creating a release in GitHub should trigger a release workflow that builds and publishes to PyPi.
To manually release, update the version in pyproject.toml
, build and publish with poetry:
poetry build
poetry publish
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
evnex-0.4.1.tar.gz
(12.8 kB
view details)
Built Distribution
evnex-0.4.1-py3-none-any.whl
(15.5 kB
view details)
File details
Details for the file evnex-0.4.1.tar.gz
.
File metadata
- Download URL: evnex-0.4.1.tar.gz
- Upload date:
- Size: 12.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.11.7 Linux/6.5.0-28-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | df0c8ef00a30b5ee5a684e19579e8700b6cd2dd1dead8b692f7b6d344c6730f5 |
|
MD5 | 71e971da83966a22ddba5778cb346430 |
|
BLAKE2b-256 | 001184dff1c993e3f45002774653f1e7c1f0894659dc6ebe8920f094665023e5 |
File details
Details for the file evnex-0.4.1-py3-none-any.whl
.
File metadata
- Download URL: evnex-0.4.1-py3-none-any.whl
- Upload date:
- Size: 15.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.11.7 Linux/6.5.0-28-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4f1654b3277305cbb9c466ddef482e3f77fc15a522e10d8ffc0f38c312007b3c |
|
MD5 | 6d75dabb4c8505a723a5a9c75d67a601 |
|
BLAKE2b-256 | 91e958451953b2f79e7a2f92e6411a5358a49a66a1e046d6c9cc607fbab035fa |