[client] Unify query-param style: params= everywhere (f-string query concat in several reads) #185

Closed
opened 2026-10-27 11:31:56 +00:00 by mat · 0 comments
Owner

Query-string construction splits between two styles:

  • f-string concat: switch_capacity (_capacities.py:25, .../switch?enable={...}), get_devices (_devices.py:23, .../devices?siteId={site_id});
  • params=: the sibling set_pilot_wire (_capacities.py:44), the whole aggregations module.

The params= style URL-encodes values and keeps query keys greppable; the f-string style risks encoding bugs the day a value contains &, spaces or unicode — site_uid values are opaque strings, so this is not hypothetical.

Fix: use params= everywhere. Purely internal (request URLs identical for current inputs), so no API change; existing tests keep asserting the same query strings.

Done when: no f-string query construction remains in comwatt_client/, pytest -q green.

Query-string construction splits between two styles: - **f-string concat:** `switch_capacity` (`_capacities.py:25`, `.../switch?enable={...}`), `get_devices` (`_devices.py:23`, `.../devices?siteId={site_id}`); - **`params=`:** the sibling `set_pilot_wire` (`_capacities.py:44`), the whole aggregations module. The `params=` style URL-encodes values and keeps query keys greppable; the f-string style risks encoding bugs the day a value contains `&`, spaces or unicode — `site_uid` values are opaque strings, so this is not hypothetical. **Fix:** use `params=` everywhere. Purely internal (request URLs identical for current inputs), so no API change; existing tests keep asserting the same query strings. **Done when:** no f-string query construction remains in `comwatt_client/`, `pytest -q` green.
mat closed this issue 2026-10-27 14:41:05 +00:00
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
mat/python-comwatt-client#185
No description provided.