Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions evnex/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,14 @@ def _common_headers(self):
"User-Agent": f"python-evnex/{self.version}",
}

async def _request(self, method: str, path: str, **kwargs) -> Response:
async def _request(self, method: str, path: str, timeout=30, **kwargs) -> Response:
"""Single request path: base URL, headers, auth, and 401 recovery."""
return await self.httpx_client.request(
method,
f"{self._base_url}{path}",
headers=self._common_headers,
auth=self._httpx_auth,
timeout=timeout,
**kwargs,
)

Expand Down Expand Up @@ -352,7 +353,7 @@ async def get_charge_point_status(

@api_retry(ReadTimeout)
async def get_charge_point_energy_meter_reading(
self, charge_point_id: str, timeout: float = 30
self, charge_point_id: str
) -> EvnexChargePointEnergyMeterReadingResponse:
"""
:param charge_point_id:
Expand All @@ -361,7 +362,6 @@ async def get_charge_point_energy_meter_reading(
r = await self._request(
"POST",
f"/charge-points/{charge_point_id}/commands/get-energy-meter-reading",
timeout=timeout,
)
json_data = await self._check_api_response(r)

Expand Down
34 changes: 34 additions & 0 deletions examples/get_org_chargepoints.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import asyncio
import os

from evnex.api import Evnex
from evnex.auth import EvnexAuth


async def main():
auth = EvnexAuth()
await auth.start_authentication(
os.environ["EVNEX_CLIENT_USERNAME"], os.environ["EVNEX_CLIENT_PASSWORD"]
)
evnex = Evnex(auth=auth)

user_data = await evnex.get_user_detail()

print("User:", user_data.name, user_data.email, user_data.id)

user_data = await evnex.get_org_charge_points(evnex.org_id)

for chargepoint in user_data:
# print("Global connector statuses")
# status = await evnex.get_org_summary_status(org_id=org.slug)
# print(status)
print(chargepoint.id)
if chargepoint.connectors:
for connector in chargepoint.connectors:
print(connector.connectorType)
print(connector.status)
print(connector.evseId)


if __name__ == "__main__":
asyncio.run(main())
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "evnex"
version = "0.7.0"
version = "0.7.1"
description = "A Python wrapper for the EVNEX Cloud API"
authors = [{ name = "Brian Thorne", email = "brian@hardbyte.nz" }]
readme = "README.md"
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.