ideal-postcodes 0.2.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ideal-postcodes
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: Explicit Python client for Ideal Postcodes
5
5
  Keywords: address,postcode,address-lookup,address-autocomplete,uk
6
6
  Author: Ideal Postcodes
@@ -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
- if response.headers.get("Content-Type", "").split(";", 1)[0].strip().lower() != "text/csv":
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:
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "ideal-postcodes"
3
- version = "0.2.1"
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"
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "ideal-postcodes"
3
- version = "0.2.1"
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"
File without changes