ideal-postcodes 0.1.1__tar.gz → 0.2.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ideal_postcodes-0.1.1 → ideal_postcodes-0.2.2}/PKG-INFO +1 -1
- {ideal_postcodes-0.1.1 → ideal_postcodes-0.2.2}/ideal_postcodes/_transport.py +4 -1
- {ideal_postcodes-0.1.1 → ideal_postcodes-0.2.2}/ideal_postcodes/client.py +17 -17
- {ideal_postcodes-0.1.1 → ideal_postcodes-0.2.2}/ideal_postcodes/types.py +25 -55
- {ideal_postcodes-0.1.1 → ideal_postcodes-0.2.2}/pyproject.toml +2 -2
- {ideal_postcodes-0.1.1 → ideal_postcodes-0.2.2}/pyproject.toml.orig +2 -2
- {ideal_postcodes-0.1.1 → ideal_postcodes-0.2.2}/LICENSE +0 -0
- {ideal_postcodes-0.1.1 → ideal_postcodes-0.2.2}/README.md +0 -0
- {ideal_postcodes-0.1.1 → ideal_postcodes-0.2.2}/ideal_postcodes/__init__.py +0 -0
- {ideal_postcodes-0.1.1 → ideal_postcodes-0.2.2}/ideal_postcodes/errors.py +0 -0
- {ideal_postcodes-0.1.1 → ideal_postcodes-0.2.2}/ideal_postcodes/py.typed +0 -0
- {ideal_postcodes-0.1.1 → ideal_postcodes-0.2.2}/ideal_postcodes/requests.py +0 -0
|
@@ -182,7 +182,10 @@ class Transport:
|
|
|
182
182
|
if response.status_code != 200:
|
|
183
183
|
raise ProtocolError(f"Unexpected success status {response.status_code}")
|
|
184
184
|
if result_shape == "csv":
|
|
185
|
-
|
|
185
|
+
# The API sends `text/csv name="..."`, a space before the parameter rather than a
|
|
186
|
+
# semicolon, so the media type ends at the first semicolon or whitespace.
|
|
187
|
+
media_type = (response.headers.get("Content-Type", "").replace(";", " ").split() or [""])[0].lower()
|
|
188
|
+
if media_type != "text/csv":
|
|
186
189
|
raise ProtocolError("Expected a CSV response")
|
|
187
190
|
return response.text
|
|
188
191
|
if envelope.get("code") != 2000 or "result" not in envelope or envelope["result"] is None:
|
|
@@ -315,7 +315,7 @@ class IdealPostcodes(Transport):
|
|
|
315
315
|
"""Availability.
|
|
316
316
|
|
|
317
317
|
GET /keys/{key}. Returns the result payload.
|
|
318
|
-
key: Required. The API Key
|
|
318
|
+
key: Required. The API Key. Begins `ak_`.
|
|
319
319
|
|
|
320
320
|
Raises APIError, TransportError or ProtocolError on failure.
|
|
321
321
|
"""
|
|
@@ -329,7 +329,7 @@ class IdealPostcodes(Transport):
|
|
|
329
329
|
"""Details.
|
|
330
330
|
|
|
331
331
|
GET /keys/{key}/details. Returns the result payload.
|
|
332
|
-
key: Required. The API Key
|
|
332
|
+
key: Required. The API Key. Begins `ak_`.
|
|
333
333
|
user_token: Required. A secret key used to manage your account and API Keys. It was previously called the user token.
|
|
334
334
|
|
|
335
335
|
Raises APIError, TransportError or ProtocolError on failure.
|
|
@@ -360,7 +360,7 @@ class IdealPostcodes(Transport):
|
|
|
360
360
|
"""Update Details.
|
|
361
361
|
|
|
362
362
|
PUT /keys/{key}/details. Returns the result payload.
|
|
363
|
-
key: Required. The API Key
|
|
363
|
+
key: Required. The API Key. Begins `ak_`.
|
|
364
364
|
user_token: Required. A secret key used to manage your account and API Keys. It was previously called the user token.
|
|
365
365
|
name: Optional. A name for the key maxLength=32
|
|
366
366
|
daily_limit: Optional.
|
|
@@ -370,7 +370,7 @@ class IdealPostcodes(Transport):
|
|
|
370
370
|
redact_days: Optional. Number of days to preserve personal data stored in your key usage history. Set to 0 to prevent personal data storage default=28; minimum=0; maximum=1095
|
|
371
371
|
notifications: Optional.
|
|
372
372
|
ip_forwarding: Optional. Accept IP addresses forwarded in the `IDPC-Source-IP` header default=False
|
|
373
|
-
datasets: Optional.
|
|
373
|
+
datasets: Optional. Datasets you can switch on or off for this key. Datasets set by your plan (`paf`, `mr`, `nyb`, `ecad`, `ecaf`) cannot be changed here: sending one with a different value returns a 400.
|
|
374
374
|
|
|
375
375
|
Raises APIError, TransportError or ProtocolError on failure.
|
|
376
376
|
"""
|
|
@@ -426,7 +426,7 @@ class IdealPostcodes(Transport):
|
|
|
426
426
|
"""Usage Stats.
|
|
427
427
|
|
|
428
428
|
GET /keys/{key}/usage. Returns the result payload.
|
|
429
|
-
key: Required. The API Key
|
|
429
|
+
key: Required. The API Key. Begins `ak_`.
|
|
430
430
|
user_token: Required. A secret key used to manage your account and API Keys. It was previously called the user token.
|
|
431
431
|
start: Optional. A start date/time in the form of a UNIX Timestamp in milliseconds. E.g. `1418556452651` minimum=0
|
|
432
432
|
end: Optional. An end date/time in the form of a UNIX Timestamp in milliseconds. E.g. `1418556477882` minimum=0
|
|
@@ -463,7 +463,7 @@ class IdealPostcodes(Transport):
|
|
|
463
463
|
"""Logs (CSV).
|
|
464
464
|
|
|
465
465
|
GET /keys/{key}/lookups. Returns CSV text.
|
|
466
|
-
key: Required. The API Key
|
|
466
|
+
key: Required. The API Key. Begins `ak_`.
|
|
467
467
|
user_token: Required. A secret key used to manage your account and API Keys. It was previously called the user token.
|
|
468
468
|
start: Optional. A start date/time in the form of a UNIX Timestamp in milliseconds. E.g. `1418556452651` minimum=0
|
|
469
469
|
end: Optional. An end date/time in the form of a UNIX Timestamp in milliseconds. E.g. `1418556477882` minimum=0
|
|
@@ -986,7 +986,7 @@ class IdealPostcodes(Transport):
|
|
|
986
986
|
"""List.
|
|
987
987
|
|
|
988
988
|
GET /keys/{key}/licensees. Returns the result payload.
|
|
989
|
-
key: Required. The API Key
|
|
989
|
+
key: Required. The API Key. Begins `ak_`.
|
|
990
990
|
starting_after: Optional. ID of the licensee after which to list results
|
|
991
991
|
user_token: Required. A secret key used to manage your account and API Keys. It was previously called the user token.
|
|
992
992
|
limit: Optional. Specifies the maximum number of records to retrieve. default=10; minimum=1; maximum=100
|
|
@@ -1029,7 +1029,7 @@ class IdealPostcodes(Transport):
|
|
|
1029
1029
|
"""Create.
|
|
1030
1030
|
|
|
1031
1031
|
POST /keys/{key}/licensees. Returns the result payload.
|
|
1032
|
-
key: Required. The API Key
|
|
1032
|
+
key: Required. The API Key. Begins `ak_`.
|
|
1033
1033
|
user_token: Required. A secret key used to manage your account and API Keys. It was previously called the user token.
|
|
1034
1034
|
name: Optional. Licensee individual or organisation name
|
|
1035
1035
|
address: Optional. Licensee's first, second and third line address as well as post town concatenated by commas
|
|
@@ -1068,7 +1068,7 @@ class IdealPostcodes(Transport):
|
|
|
1068
1068
|
"""Retrieve.
|
|
1069
1069
|
|
|
1070
1070
|
GET /keys/{key}/licensees/{licensee}. Returns the result payload.
|
|
1071
|
-
key: Required. The API Key
|
|
1071
|
+
key: Required. The API Key. Begins `ak_`.
|
|
1072
1072
|
licensee: Required. Uniquely identifies a licensee.
|
|
1073
1073
|
user_token: Required. A secret key used to manage your account and API Keys. It was previously called the user token.
|
|
1074
1074
|
|
|
@@ -1087,7 +1087,7 @@ class IdealPostcodes(Transport):
|
|
|
1087
1087
|
"""Cancel.
|
|
1088
1088
|
|
|
1089
1089
|
DELETE /keys/{key}/licensees/{licensee}. Returns the result payload.
|
|
1090
|
-
key: Required. The API Key
|
|
1090
|
+
key: Required. The API Key. Begins `ak_`.
|
|
1091
1091
|
licensee: Required. Uniquely identifies a licensee.
|
|
1092
1092
|
user_token: Required. A secret key used to manage your account and API Keys. It was previously called the user token.
|
|
1093
1093
|
|
|
@@ -1117,7 +1117,7 @@ class IdealPostcodes(Transport):
|
|
|
1117
1117
|
"""Update.
|
|
1118
1118
|
|
|
1119
1119
|
POST /keys/{key}/licensees/{licensee}. Returns the result payload.
|
|
1120
|
-
key: Required. The API Key
|
|
1120
|
+
key: Required. The API Key. Begins `ak_`.
|
|
1121
1121
|
licensee: Required. Uniquely identifies a licensee.
|
|
1122
1122
|
user_token: Required. A secret key used to manage your account and API Keys. It was previously called the user token.
|
|
1123
1123
|
name: Optional. Licensee individual or organisation name
|
|
@@ -1158,7 +1158,7 @@ class IdealPostcodes(Transport):
|
|
|
1158
1158
|
"""Regenerate Key.
|
|
1159
1159
|
|
|
1160
1160
|
POST /keys/{key}/licensees/{licensee}/regenerate-key. Returns the result payload.
|
|
1161
|
-
key: Required. The API Key
|
|
1161
|
+
key: Required. The API Key. Begins `ak_`.
|
|
1162
1162
|
licensee: Required. Uniquely identifies a licensee.
|
|
1163
1163
|
user_token: Required. A secret key used to manage your account and API Keys. It was previously called the user token.
|
|
1164
1164
|
|
|
@@ -1179,7 +1179,7 @@ class IdealPostcodes(Transport):
|
|
|
1179
1179
|
"""List.
|
|
1180
1180
|
|
|
1181
1181
|
GET /keys/{key}/configs. Returns the result payload.
|
|
1182
|
-
key: Required. The API Key
|
|
1182
|
+
key: Required. The API Key. Begins `ak_`.
|
|
1183
1183
|
user_token: Required. A secret key used to manage your account and API Keys. It was previously called the user token.
|
|
1184
1184
|
|
|
1185
1185
|
Raises APIError, TransportError or ProtocolError on failure.
|
|
@@ -1196,7 +1196,7 @@ class IdealPostcodes(Transport):
|
|
|
1196
1196
|
"""Create.
|
|
1197
1197
|
|
|
1198
1198
|
POST /keys/{key}/configs. Returns the result payload.
|
|
1199
|
-
key: Required. The API Key
|
|
1199
|
+
key: Required. The API Key. Begins `ak_`.
|
|
1200
1200
|
user_token: Required. A secret key used to manage your account and API Keys. It was previously called the user token.
|
|
1201
1201
|
name: Required. A unique name to identify the configuration payload minLength=1; maxLength=32
|
|
1202
1202
|
payload: Required. A serialised payload of up to `65536` characters minLength=0; maxLength=65536
|
|
@@ -1221,7 +1221,7 @@ class IdealPostcodes(Transport):
|
|
|
1221
1221
|
"""Retrieve.
|
|
1222
1222
|
|
|
1223
1223
|
GET /keys/{key}/configs/{config}. Returns the result payload.
|
|
1224
|
-
key: Required. The API Key
|
|
1224
|
+
key: Required. The API Key. Begins `ak_`.
|
|
1225
1225
|
config: Required. User-provided configuration object name.
|
|
1226
1226
|
|
|
1227
1227
|
Raises APIError, TransportError or ProtocolError on failure.
|
|
@@ -1238,7 +1238,7 @@ class IdealPostcodes(Transport):
|
|
|
1238
1238
|
"""Delete.
|
|
1239
1239
|
|
|
1240
1240
|
DELETE /keys/{key}/configs/{config}. Returns the result payload.
|
|
1241
|
-
key: Required. The API Key
|
|
1241
|
+
key: Required. The API Key. Begins `ak_`.
|
|
1242
1242
|
config: Required. User-provided configuration object name.
|
|
1243
1243
|
user_token: Required. A secret key used to manage your account and API Keys. It was previously called the user token.
|
|
1244
1244
|
|
|
@@ -1259,7 +1259,7 @@ class IdealPostcodes(Transport):
|
|
|
1259
1259
|
"""Update.
|
|
1260
1260
|
|
|
1261
1261
|
POST /keys/{key}/configs/{config}. Returns the result payload.
|
|
1262
|
-
key: Required. The API Key
|
|
1262
|
+
key: Required. The API Key. Begins `ak_`.
|
|
1263
1263
|
config: Required. User-provided configuration object name.
|
|
1264
1264
|
user_token: Required. A secret key used to manage your account and API Keys. It was previously called the user token.
|
|
1265
1265
|
payload: Optional. A serialised payload of up to `65536` characters minLength=0; maxLength=65536
|
|
@@ -66,7 +66,7 @@ type Umprn = Annotated[
|
|
|
66
66
|
|
|
67
67
|
|
|
68
68
|
type ID = Annotated[
|
|
69
|
-
str, Field(description="
|
|
69
|
+
str, Field(description="Globally unique internally generated identifier for an address", title="Address Identifier")
|
|
70
70
|
]
|
|
71
71
|
|
|
72
72
|
|
|
@@ -5646,6 +5646,14 @@ class Daily(BaseModel):
|
|
|
5646
5646
|
model_config = ConfigDict(
|
|
5647
5647
|
extra="allow",
|
|
5648
5648
|
)
|
|
5649
|
+
limit: Annotated[
|
|
5650
|
+
float | None,
|
|
5651
|
+
Field(
|
|
5652
|
+
description="The maximum number of lookups this licensee can perform in a day. `null` indicates the limit is not active",
|
|
5653
|
+
examples=[10000],
|
|
5654
|
+
ge=0.0,
|
|
5655
|
+
),
|
|
5656
|
+
]
|
|
5649
5657
|
count: Annotated[
|
|
5650
5658
|
float,
|
|
5651
5659
|
Field(
|
|
@@ -5663,24 +5671,6 @@ class Licensee(BaseModel):
|
|
|
5663
5671
|
model_config = ConfigDict(
|
|
5664
5672
|
extra="allow",
|
|
5665
5673
|
)
|
|
5666
|
-
name: Annotated[
|
|
5667
|
-
str, Field(description="Licensee individual or organisation name", examples=["Qwerty Widgets Limited"])
|
|
5668
|
-
]
|
|
5669
|
-
address: Annotated[
|
|
5670
|
-
str,
|
|
5671
|
-
Field(
|
|
5672
|
-
description="Licensee's first, second and third line address as well as post town concatenated by commas",
|
|
5673
|
-
examples=["12 High Street, Manchester"],
|
|
5674
|
-
),
|
|
5675
|
-
]
|
|
5676
|
-
postcode: Annotated[str, Field(description="Licensee's postcode", examples=["BR8 7RE"])]
|
|
5677
|
-
whitelist: Annotated[
|
|
5678
|
-
list[str],
|
|
5679
|
-
Field(
|
|
5680
|
-
description="A list of allowed URLs. An empty list disables the check.\n\nA request is allowed when its `Origin` or `Referer` header matches an entry. Use one of these formats:\n\n- `https://www.example.com` allows one site. Scheme and host must match\n- `*.example.com` allows the domain and all its subdomains"
|
|
5681
|
-
),
|
|
5682
|
-
]
|
|
5683
|
-
daily: Daily
|
|
5684
5674
|
id: Annotated[
|
|
5685
5675
|
str,
|
|
5686
5676
|
Field(
|
|
@@ -5691,51 +5681,31 @@ class Licensee(BaseModel):
|
|
|
5691
5681
|
key: Annotated[
|
|
5692
5682
|
str,
|
|
5693
5683
|
Field(
|
|
5694
|
-
description="Uniquely identifies a licensee for a key
|
|
5684
|
+
description="Uniquely identifies a licensee for a key.\n\nRequired to perform paid lookups for a specific licensee. Typically begins `sl_`.\n",
|
|
5695
5685
|
examples=["sl_ijoiqsxeQgXW2gkiE0X94"],
|
|
5696
5686
|
),
|
|
5697
5687
|
]
|
|
5698
5688
|
createdAt: Annotated[
|
|
5699
5689
|
str, Field(description="Timestamp for when the licensee was created", examples=["2016-01-21T17:14:49.971Z"])
|
|
5700
5690
|
]
|
|
5701
|
-
|
|
5702
|
-
|
|
5703
|
-
class Daily1(BaseModel):
|
|
5704
|
-
model_config = ConfigDict(
|
|
5705
|
-
extra="allow",
|
|
5706
|
-
)
|
|
5707
|
-
limit: Annotated[
|
|
5708
|
-
float | None,
|
|
5709
|
-
Field(
|
|
5710
|
-
description="The maximum number of lookups this licensee can perform in a day. `null` indicates the limit is not active",
|
|
5711
|
-
examples=[10000],
|
|
5712
|
-
ge=0.0,
|
|
5713
|
-
),
|
|
5714
|
-
] = None
|
|
5715
|
-
|
|
5716
|
-
|
|
5717
|
-
class LicenseeEditable(BaseModel):
|
|
5718
|
-
model_config = ConfigDict(
|
|
5719
|
-
extra="allow",
|
|
5720
|
-
)
|
|
5721
5691
|
name: Annotated[
|
|
5722
|
-
str
|
|
5723
|
-
]
|
|
5692
|
+
str, Field(description="Licensee individual or organisation name", examples=["Qwerty Widgets Limited"])
|
|
5693
|
+
]
|
|
5724
5694
|
address: Annotated[
|
|
5725
|
-
str
|
|
5695
|
+
str,
|
|
5726
5696
|
Field(
|
|
5727
5697
|
description="Licensee's first, second and third line address as well as post town concatenated by commas",
|
|
5728
5698
|
examples=["12 High Street, Manchester"],
|
|
5729
5699
|
),
|
|
5730
|
-
]
|
|
5731
|
-
postcode: Annotated[str
|
|
5700
|
+
]
|
|
5701
|
+
postcode: Annotated[str, Field(description="Licensee's postcode", examples=["BR8 7RE"])]
|
|
5732
5702
|
whitelist: Annotated[
|
|
5733
|
-
list[str]
|
|
5703
|
+
list[str],
|
|
5734
5704
|
Field(
|
|
5735
5705
|
description="A list of allowed URLs. An empty list disables the check.\n\nA request is allowed when its `Origin` or `Referer` header matches an entry. Use one of these formats:\n\n- `https://www.example.com` allows one site. Scheme and host must match\n- `*.example.com` allows the domain and all its subdomains"
|
|
5736
5706
|
),
|
|
5737
|
-
]
|
|
5738
|
-
daily:
|
|
5707
|
+
]
|
|
5708
|
+
daily: Daily
|
|
5739
5709
|
|
|
5740
5710
|
|
|
5741
5711
|
class Config(BaseModel):
|
|
@@ -5743,10 +5713,10 @@ class Config(BaseModel):
|
|
|
5743
5713
|
extra="allow",
|
|
5744
5714
|
)
|
|
5745
5715
|
updatedAt: Annotated[
|
|
5746
|
-
str, Field(description="Timestamp for when the config was
|
|
5716
|
+
str, Field(description="Timestamp for when the config was last updated", examples=["2016-01-21T17:14:49.971Z"])
|
|
5747
5717
|
]
|
|
5748
5718
|
createdAt: Annotated[
|
|
5749
|
-
str, Field(description="Timestamp for when the config was
|
|
5719
|
+
str, Field(description="Timestamp for when the config was created", examples=["2016-01-21T17:14:49.971Z"])
|
|
5750
5720
|
]
|
|
5751
5721
|
name: Annotated[
|
|
5752
5722
|
str,
|
|
@@ -5958,13 +5928,13 @@ class ListLicenseesResult(BaseModel):
|
|
|
5958
5928
|
model_config = ConfigDict(
|
|
5959
5929
|
extra="allow",
|
|
5960
5930
|
)
|
|
5961
|
-
licensees: list[Licensee]
|
|
5931
|
+
licensees: list[Licensee]
|
|
5962
5932
|
hasMore: Annotated[
|
|
5963
|
-
bool
|
|
5933
|
+
bool,
|
|
5964
5934
|
Field(
|
|
5965
5935
|
description="Returns true if there are more licensees listed after the maximum number of results as implied by `limit`"
|
|
5966
5936
|
),
|
|
5967
|
-
]
|
|
5937
|
+
]
|
|
5968
5938
|
|
|
5969
5939
|
|
|
5970
5940
|
type CreateLicenseeResult = Licensee
|
|
@@ -6236,7 +6206,7 @@ class ApiKey(BaseModel):
|
|
|
6236
6206
|
available: Annotated[
|
|
6237
6207
|
bool,
|
|
6238
6208
|
Field(
|
|
6239
|
-
description="Determines whether the key can be used by the requesting agent. \n\nReturns false if one of the following conditions is met:\n - Key has no lookups remaining\n - Daily limit has been reached on the key\n - Daily individual limit has been reached\n - Key is not being used via an authorised URL\n - (Sublicensed key only) Key has
|
|
6209
|
+
description="Determines whether the key can be used by the requesting agent. \n\nReturns false if one of the following conditions is met:\n - Key has no lookups remaining\n - Daily limit has been reached on the key\n - Daily individual limit has been reached\n - Key is not being used via an authorised URL\n - (Sublicensed key only) Key has no valid licensee attached\n - (Sublicensed key only) Key is not being used via an authorised URL specified by licensee\n",
|
|
6240
6210
|
examples=[True],
|
|
6241
6211
|
),
|
|
6242
6212
|
]
|
|
@@ -6363,7 +6333,7 @@ class Place(BaseModel):
|
|
|
6363
6333
|
extra="allow",
|
|
6364
6334
|
)
|
|
6365
6335
|
id: Annotated[
|
|
6366
|
-
str, Field(description="
|
|
6336
|
+
str, Field(description="Globally unique internally generated identifier for a place", title="Place Identifier")
|
|
6367
6337
|
]
|
|
6368
6338
|
dataset: Annotated[str, Field(description="Indicates the provenance of a place.", title="Dataset")]
|
|
6369
6339
|
name: PlaceName
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "ideal-postcodes"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.2.2"
|
|
4
4
|
description = "Explicit Python client for Ideal Postcodes"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.12"
|
|
@@ -75,7 +75,7 @@ dev = [
|
|
|
75
75
|
"datamodel-code-generator==0.83.0",
|
|
76
76
|
"jsonschema==4.26.0",
|
|
77
77
|
"pyright==1.1.414",
|
|
78
|
-
"pytest==
|
|
78
|
+
"pytest==9.0.3",
|
|
79
79
|
"pyyaml==6.0.3",
|
|
80
80
|
"ruff==0.17.0",
|
|
81
81
|
]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "ideal-postcodes"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.2.2"
|
|
4
4
|
description = "Explicit Python client for Ideal Postcodes"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.12"
|
|
@@ -36,7 +36,7 @@ dev = [
|
|
|
36
36
|
"datamodel-code-generator==0.83.0",
|
|
37
37
|
"jsonschema==4.26.0",
|
|
38
38
|
"pyright==1.1.414",
|
|
39
|
-
"pytest==
|
|
39
|
+
"pytest==9.0.3",
|
|
40
40
|
"pyyaml==6.0.3",
|
|
41
41
|
"ruff==0.17.0",
|
|
42
42
|
]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|