I was try to cache stable address keys and use them to more efficiently re-query data I've already geocoded and ran into this, replicated below:
import os, requests
from geocodio import Geocodio
addr = "1109 N Highland St, Arlington VA"
key = os.environ["GEOCODIO_API_KEY"]
# /v2 returns stable_address_key on every result by default:
raw = requests.get("https://api.geocod.io/v2/geocode",
params={"q": addr, "api_key": key}).json()
print("API :", raw["results"][0]["stable_address_key"])
# ...but the library's parsed result has no field for it;
# and it appears that because GeocodingResult uses
# @dataclass(slots=True, frozen=True), it can't be attached after the fact
result = Geocodio(key).geocode(addr).results[0]
print("library :", hasattr(result, "stable_address_key")) # -> False
I was try to cache stable address keys and use them to more efficiently re-query data I've already geocoded and ran into this, replicated below: