Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
20 changes: 1 addition & 19 deletions googlemaps/places.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
]
)
Expand All @@ -61,7 +59,6 @@
[
"address_component",
"adr_address",
"alt_id", # deprecated: https://developers.google.com/maps/deprecations
"formatted_address",
"geometry",
"geometry/location",
Expand All @@ -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",
Expand All @@ -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
):
Expand Down Expand Up @@ -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(
Expand Down
8 changes: 4 additions & 4 deletions googlemaps/test/test_places.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand Down