diff --git a/CHANGELOG.md b/CHANGELOG.md index 92a9f4f3..4c322577 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,9 +2,9 @@ All notable changes to this project will be documented in this file. ## [Unreleased] +## [v3.1.3] ### Changed -### Added -### Removed +- deprecation warning for place fields: `alt_id`, `id`, `reference`, and `scope`. Read more about this at https://developers.google.com/maps/deprecations. ## [v3.1.2] ### Added @@ -33,7 +33,8 @@ All notable changes to this project will be documented in this file. **Note:** Start of changelog is 2019-08-27, [v3.0.2]. -[Unreleased]: https://github.com/googlemaps/google-maps-services-python/compare/3.1.2...HEAD +[Unreleased]: https://github.com/googlemaps/google-maps-services-python/compare/3.1.3...HEAD +[v3.1.3]: https://github.com/googlemaps/google-maps-services-python/compare/3.1.2...3.1.3 [v3.1.2]: https://github.com/googlemaps/google-maps-services-python/compare/3.1.1...3.1.2 [v3.1.1]: https://github.com/googlemaps/google-maps-services-python/compare/3.1.0...3.1.1 [v3.1.0]: https://github.com/googlemaps/google-maps-services-python/compare/3.0.2...3.1.0 diff --git a/googlemaps/places.py b/googlemaps/places.py index a77f2d85..87110cc1 100644 --- a/googlemaps/places.py +++ b/googlemaps/places.py @@ -16,6 +16,7 @@ # """Performs requests to the Google Places API.""" +import warnings from googlemaps import convert @@ -35,13 +36,13 @@ "geometry/viewport/southwest/lat", "geometry/viewport/southwest/lng", "icon", - "id", + "id", # deprecated: https://developers.google.com/maps/deprecations "name", "permanently_closed", "photos", "place_id", "plus_code", - "scope", + "scope", # deprecated: https://developers.google.com/maps/deprecations "types", ] ) @@ -60,7 +61,7 @@ [ "address_component", "adr_address", - "alt_id", + "alt_id", # deprecated: https://developers.google.com/maps/deprecations "formatted_address", "geometry", "geometry/location", @@ -74,13 +75,13 @@ "geometry/viewport/southwest/lat", "geometry/viewport/southwest/lng", "icon", - "id", + "id", # deprecated: https://developers.google.com/maps/deprecations "name", "permanently_closed", "photo", "place_id", "plus_code", - "scope", + "scope", # deprecated: https://developers.google.com/maps/deprecations "type", "url", "utc_offset", @@ -102,6 +103,11 @@ ^ PLACES_DETAIL_FIELDS_ATMOSPHERE ) +DEPRECATED_FIELDS = {"alt_id", "id", "reference", "scope"} +DEPRECATED_FIELDS_MESSAGE = ( + "Fields, %s, are deprecated. " + "Read more at https://developers.google.com/maps/deprecations." +) def find_place( client, input, input_type, fields=None, location_bias=None, language=None @@ -147,6 +153,13 @@ def find_place( ) if fields: + deprecated_fields = set(fields) & DEPRECATED_FIELDS + if deprecated_fields: + warnings.warn( + DEPRECATED_FIELDS_MESSAGE % str(list(deprecated_fields)), + DeprecationWarning + ) + invalid_fields = set(fields) - PLACES_FIND_FIELDS if invalid_fields: raise ValueError( diff --git a/setup.py b/setup.py index 812e43f2..9a901068 100644 --- a/setup.py +++ b/setup.py @@ -21,7 +21,7 @@ setup( name="googlemaps", - version="3.1.2", + version="3.1.3", description="Python client library for Google Maps Platform", long_description=readme + changelog, long_description_content_type="text/markdown",