Skip to content

formatted_address is unavailable before get_details() #122

@danFromTelAviv

Description

@danFromTelAviv

Hi,
Thanks for this amazing wrapper. It is so much better than google's api.

using the following code :

query_result = google_places.text_search(
            query="random place", lat_lng={"lat": 33.5, "lng": -86.8}, radius=100)

for idx, place in enumerate(query_result.places)
    print(place.formatted_address) 

give the following error :

googleplaces.GooglePlacesAttributeError: The attribute requested is only available after an explicit call to get_details() is made.

When using google's api directly this information is available without the additional get_details().
I worked around this by adding self.place_data = place_data to the Place class. I then call place.place_data.formatted_address instead of place.formatted_address and that works fine.

How would you suggest to implement this in a more proper way.

Thanks again

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions