Commit 4f04d15
authored
Migrate to Geocodio API v2 (#23)
* Migrate to Geocodio API v2
Breaking change: migrate the client to the Geocodio v2 API.
- Bump base URL version prefix from v1.x to v2 (BASE_PATH = "/v2").
- Remove the top-level `input` object from /geocode and /reverse response
parsing. GeocodingResponse.input has been removed; parsed address data
now lives in results[].address_components.
- Rename AddressComponents fields to match v2:
- zip -> postal_code
- state -> state_province
- add unit_type (was secondaryunit) and unit_number (was secondarynumber)
- Structured address input now accepts state_province (legacy `state`
still accepted for compatibility).
- Bump version 0.5.1 -> 1.0.0 (pyproject.toml + _version.py); update
CHANGELOG.md and smoke_lists.py version references.
- Update unit-test fixtures and assertions for the v2 response shape.
- Add isort black profile so black/isort agree on import formatting.
* Update e2e test assertions to v2 address-component names
The unit tests were migrated to v2 but tests/e2e/test_api.py still
asserted on the removed .state/.zip attributes, raising KeyError
against the live v2 API. Rename to .state_province/.postal_code.
* Fix pre-existing state-legislative district_number type assertion
The live API returns state-legislative district_number as a string
(model types it as Any); the e2e test wrongly asserted int. Assert
presence instead. Unrelated to v2; surfaced now that e2e runs green
on geocode/reverse. Congressional district_number (int) left as-is.
* Relax state-leg proportion assertion to accept int or float
API returns proportion as int (1) for whole-district representation;
test asserted float only. Accept (int, float). Same pre-existing
type-assertion class as district_number, unrelated to v2.1 parent ec82fa2 commit 4f04d15
25 files changed
Lines changed: 1531 additions & 1261 deletions
File tree
- src/geocodio
- tests
- e2e
- unit
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
10 | 21 | | |
11 | 22 | | |
12 | 23 | | |
| |||
16 | 27 | | |
17 | 28 | | |
18 | 29 | | |
19 | | - | |
20 | 30 | | |
21 | 31 | | |
22 | 32 | | |
| |||
69 | 79 | | |
70 | 80 | | |
71 | 81 | | |
72 | | - | |
| 82 | + | |
| 83 | + | |
73 | 84 | | |
74 | 85 | | |
75 | 86 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
51 | 54 | | |
52 | 55 | | |
53 | 56 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
| 60 | + | |
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
| 69 | + | |
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | | - | |
13 | 11 | | |
14 | 12 | | |
15 | | - | |
16 | | - | |
| 13 | + | |
17 | 14 | | |
18 | 15 | | |
19 | 16 | | |
20 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | | - | |
25 | 23 | | |
26 | | - | |
27 | 24 | | |
| 25 | + | |
28 | 26 | | |
| 27 | + | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
0 commit comments