From 1617407e263a4e7ba121e9d276c2e1c09b430330 Mon Sep 17 00:00:00 2001 From: andrew misiti Date: Mon, 23 Mar 2026 12:53:57 -0400 Subject: [PATCH 1/4] added extra location kwargs to ping data --- src/pingintel_api/pingdataapi_cmd.py | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/pingintel_api/pingdataapi_cmd.py b/src/pingintel_api/pingdataapi_cmd.py index 08f25df..c5028c5 100644 --- a/src/pingintel_api/pingdataapi_cmd.py +++ b/src/pingintel_api/pingdataapi_cmd.py @@ -27,6 +27,18 @@ Example Python commandline script for using the Ping Data Technologies Data API to enhance locations with additional data. """ +def _attributes_to_dict(ctx: click.Context, attribute: click.Option, attributes: tuple[str, ...]) -> dict[str, str]: + """Click callback that converts attributes specified in the form `key=value` to a + dictionary. Thanks to https://stackoverflow.com/a/76601290/237091""" + result = {} + for arg in attributes: + k, v = arg.split("=") + if k in result: + raise click.BadParameter(f"Attribute {k!r} is specified twice") + result[k] = v + + return result + @click.group() @click.option( @@ -98,6 +110,14 @@ def get_client(ctx) -> PingDataAPIClient: @click.option("--longitude", type=float, default=None, help="Optional. Specify longitude.") @click.option("--timeout", type=float, default=None, help="Optional. Maximum time to wait for response in seconds.") @click.option("-r", "--include-raw-response", is_flag=True, help="Optional. Include raw response from all sources.") +@click.option( + "-E", + "--extra-location-kwargs", + help="Extra location kwargs in the form of key=value pairs. These will be passed through to the geocoders and other data sources.", + metavar="KEY=VALUE", + multiple=True, + callback=_attributes_to_dict, +) @click.option("--nocache", is_flag=True, help="If set, do not use cache.") def enhance( ctx: click.Context, @@ -109,11 +129,11 @@ def enhance( timeout: float | None = None, include_raw_response: bool = False, nocache: bool = False, + extra_location_kwargs: dict[str, str] | None = None, ): """Request data synchronously about a single address.""" client = get_client(ctx) - response_data = client.enhance( address=address, country=country, @@ -124,6 +144,7 @@ def enhance( include_raw_response=include_raw_response, nocache=nocache, delegate_to=ctx.obj["delegate_to"], + **(extra_location_kwargs or {}), ) click.echo(f"+ Finished querying with result:\n{pprint.pformat(response_data)}") From d8d6a79ade4c6ad5716f5fee4113a17e7eded62f Mon Sep 17 00:00:00 2001 From: andrew misiti Date: Mon, 23 Mar 2026 13:06:26 -0400 Subject: [PATCH 2/4] updating SingleLocation for pingdata to support rmslcp params --- src/pingintel_api/pingdata/types.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/pingintel_api/pingdata/types.py b/src/pingintel_api/pingdata/types.py index ca1516d..b317112 100644 --- a/src/pingintel_api/pingdata/types.py +++ b/src/pingintel_api/pingdata/types.py @@ -153,6 +153,10 @@ class SingleLocation(TypedDict): dtc_include_coastline_within_miles: NotRequired[float | None] dtc_return_connected_coastlines: NotRequired[bool | None] insured_name: NotRequired[str | None] + rmslcp__deductible_amount: NotRequired[float | None] + rmslcp__deductible_amount2: NotRequired[float | None] + rmslcp__deductible_amount3: NotRequired[float | None] + rmslcp__deductible_type: NotRequired[str | None] Location = SingleLocation From c99154a74dc4b9153458a387214a3e308afe1403 Mon Sep 17 00:00:00 2001 From: andrew misiti Date: Tue, 24 Mar 2026 10:38:56 -0400 Subject: [PATCH 3/4] eng-9390 cleanup --- src/pingintel_api/pingdata/types.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pingintel_api/pingdata/types.py b/src/pingintel_api/pingdata/types.py index b317112..a08181e 100644 --- a/src/pingintel_api/pingdata/types.py +++ b/src/pingintel_api/pingdata/types.py @@ -153,10 +153,10 @@ class SingleLocation(TypedDict): dtc_include_coastline_within_miles: NotRequired[float | None] dtc_return_connected_coastlines: NotRequired[bool | None] insured_name: NotRequired[str | None] - rmslcp__deductible_amount: NotRequired[float | None] - rmslcp__deductible_amount2: NotRequired[float | None] - rmslcp__deductible_amount3: NotRequired[float | None] - rmslcp__deductible_type: NotRequired[str | None] + deductible_amount: NotRequired[float | None] + deductible_amount2: NotRequired[float | None] + deductible_amount3: NotRequired[float | None] + deductible_type: NotRequired[str | None] Location = SingleLocation From ed3d72ad9fc6d32a2b4cff8da6da7b02596437a3 Mon Sep 17 00:00:00 2001 From: andrew misiti Date: Wed, 25 Mar 2026 13:17:21 -0400 Subject: [PATCH 4/4] fixing deductible type for SingleLocation --- src/pingintel_api/pingdata/types.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pingintel_api/pingdata/types.py b/src/pingintel_api/pingdata/types.py index a08181e..cd6945e 100644 --- a/src/pingintel_api/pingdata/types.py +++ b/src/pingintel_api/pingdata/types.py @@ -156,7 +156,7 @@ class SingleLocation(TypedDict): deductible_amount: NotRequired[float | None] deductible_amount2: NotRequired[float | None] deductible_amount3: NotRequired[float | None] - deductible_type: NotRequired[str | None] + deductible_type: NotRequired[int | None] Location = SingleLocation