From 43a12418b26f9a04377f1a01a59bae2ca211120f Mon Sep 17 00:00:00 2001 From: Justin Poehnelt Date: Thu, 19 Dec 2019 13:08:30 -0700 Subject: [PATCH 1/2] fix: remove deprecated place fields --- CHANGELOG.md | 3 +++ googlemaps/places.py | 20 +------------------- 2 files changed, 4 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f4d9f0e..8e3e5558 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ All notable changes to this project will be documented in this file. ## [Unreleased] +### Removed +- Removed place fields: `alt_id`, `id`, `reference`, and `scope`. Read more about this at https://developers.google.com/maps/deprecations. + ## [v3.1.4] ### Changed - `APIError.__str__` should always return a str (#328) diff --git a/googlemaps/places.py b/googlemaps/places.py index 87110cc1..eb748b35 100644 --- a/googlemaps/places.py +++ b/googlemaps/places.py @@ -36,13 +36,11 @@ "geometry/viewport/southwest/lat", "geometry/viewport/southwest/lng", "icon", - "id", # deprecated: https://developers.google.com/maps/deprecations "name", "permanently_closed", "photos", "place_id", "plus_code", - "scope", # deprecated: https://developers.google.com/maps/deprecations "types", ] ) @@ -61,7 +59,6 @@ [ "address_component", "adr_address", - "alt_id", # deprecated: https://developers.google.com/maps/deprecations "formatted_address", "geometry", "geometry/location", @@ -75,13 +72,11 @@ "geometry/viewport/southwest/lat", "geometry/viewport/southwest/lng", "icon", - "id", # deprecated: https://developers.google.com/maps/deprecations "name", "permanently_closed", "photo", "place_id", "plus_code", - "scope", # deprecated: https://developers.google.com/maps/deprecations "type", "url", "utc_offset", @@ -103,12 +98,6 @@ ^ 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 ): @@ -152,14 +141,7 @@ def find_place( "the given value is invalid: '%s'" % input_type ) - if fields: - deprecated_fields = set(fields) & DEPRECATED_FIELDS - if deprecated_fields: - warnings.warn( - DEPRECATED_FIELDS_MESSAGE % str(list(deprecated_fields)), - DeprecationWarning - ) - + if fields: invalid_fields = set(fields) - PLACES_FIND_FIELDS if invalid_fields: raise ValueError( From 9d1ea9919635297f08ed0f788cb23514b18a3417 Mon Sep 17 00:00:00 2001 From: Justin Poehnelt Date: Thu, 19 Dec 2019 13:16:52 -0700 Subject: [PATCH 2/2] fix: remove id from tests --- googlemaps/test/test_places.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/googlemaps/test/test_places.py b/googlemaps/test/test_places.py index f6fa9f8a..a21cd8ee 100644 --- a/googlemaps/test/test_places.py +++ b/googlemaps/test/test_places.py @@ -47,14 +47,14 @@ def test_places_find(self): status=200, content_type='application/json') self.client.find_place('restaurant', 'textquery', - fields=['geometry/location', 'id'], + fields=['geometry/location', 'place_id'], location_bias='point:90,90', language=self.language) self.assertEqual(1, len(responses.calls)) self.assertURLEqual('%s?language=en-AU&inputtype=textquery&' 'locationbias=point:90,90&input=restaurant' - '&fields=geometry/location,id&key=%s' + '&fields=geometry/location,place_id&key=%s' % (url, self.key), responses.calls[0].request.url) with self.assertRaises(ValueError): @@ -119,11 +119,11 @@ def test_place_detail(self): status=200, content_type='application/json') self.client.place('ChIJN1t_tDeuEmsRUsoyG83frY4', - fields=['geometry/location', 'id'], language=self.language) + fields=['geometry/location', 'place_id'], language=self.language) self.assertEqual(1, len(responses.calls)) self.assertURLEqual('%s?language=en-AU&placeid=ChIJN1t_tDeuEmsRUsoyG83frY4' - '&key=%s&fields=geometry/location,id' + '&key=%s&fields=geometry/location,place_id' % (url, self.key), responses.calls[0].request.url) with self.assertRaises(ValueError):