From b4d2ef4ac54bdaae79298b3b6ff5808d6c3abf25 Mon Sep 17 00:00:00 2001 From: "Mathias L. Baumann" Date: Thu, 12 Sep 2024 14:52:48 +0200 Subject: [PATCH 1/2] Fix duration in cli client.create Signed-off-by: Mathias L. Baumann --- src/frequenz/client/dispatch/__main__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/frequenz/client/dispatch/__main__.py b/src/frequenz/client/dispatch/__main__.py index afcec1b..c052e99 100644 --- a/src/frequenz/client/dispatch/__main__.py +++ b/src/frequenz/client/dispatch/__main__.py @@ -264,6 +264,10 @@ async def create( # Remove keys with `None` value kwargs = {k: v for k, v in kwargs.items() if v is not None} + # Required for client.create + if not kwargs.get("duration"): + kwargs["duration"] = None + dispatch = await ctx.obj["client"].create( recurrence=parse_recurrence(kwargs), **kwargs, From 211771223aff127b585d7a8c06400651af6e031e Mon Sep 17 00:00:00 2001 From: "Mathias L. Baumann" Date: Thu, 12 Sep 2024 14:53:13 +0200 Subject: [PATCH 2/2] Cli: Echo URL used for requests on stderr Signed-off-by: Mathias L. Baumann --- src/frequenz/client/dispatch/__main__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/frequenz/client/dispatch/__main__.py b/src/frequenz/client/dispatch/__main__.py index c052e99..92671e6 100644 --- a/src/frequenz/client/dispatch/__main__.py +++ b/src/frequenz/client/dispatch/__main__.py @@ -58,6 +58,8 @@ async def cli(ctx: click.Context, url: str, key: str) -> None: if ctx.obj is None: ctx.obj = {} + click.echo(f"Using API URL: {url}", err=True) + ctx.obj["client"] = Client( server_url=url, key=key,