Skip to content

Stable address keys do not appear to be exposed in the library #25

Description

@eads

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions