fix(python-client): omit approver from get_resume_urls when not given (#12446)

* fix(python-client): omit approver from get_resume_urls when not given

With approver=None httpx sends `?approver=`, which the server records as
an empty approver instead of falling back to "anonymous".
get_approval_urls already omits it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore: point get_resume_urls at get_approval_urls' rationale

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ruben Fiszel
2026-11-15 13:45:01 +01:00
committed by GitHub
co-authored by Claude Opus 5.5
parent 465446e1ba
commit bbb48f5a61
2 changed files with 35 additions and 1 deletions
@@ -0,0 +1,33 @@
"""The query string get_resume_urls sends, as httpx serialises it."""
import httpx
import pytest
from wmill.client import Windmill
def _sent_query(**kwargs) -> dict:
sent = []
def handler(request: httpx.Request) -> httpx.Response:
sent.append(dict(request.url.params))
return httpx.Response(200, json={})
client = Windmill(base_url="http://wm.test", token="t", workspace="ws")
client.client = httpx.Client(
base_url=client.base_url, transport=httpx.MockTransport(handler)
)
client.get_resume_urls(**kwargs)
return sent[0]
@pytest.mark.parametrize(
"kwargs, expected",
[
({}, {}),
({"flow_level": True}, {"flow_level": "true"}),
({"approver": "alice"}, {"approver": "alice"}),
],
)
def test_get_resume_urls_query(kwargs, expected):
assert _sent_query(**kwargs) == expected
+2 -1
View File
@@ -1432,7 +1432,8 @@ class Windmill:
"""
nonce = random.randint(0, 1000000000)
job_id = os.environ.get("WM_JOB_ID") or "NO_ID"
params = {"approver": approver}
# See get_approval_urls for why an absent approver is omitted.
params = {"approver": approver} if approver is not None else {}
if flow_level is not None:
params["flow_level"] = flow_level
return self.get(