I would like to get the place_id based on the telephone. So far, I was able to get the place_id with the address but I wonder if I could get the same info but with the telephone.
import googlemaps
gmaps = googlemaps.Client(key='API')
place_name = '3054 28th St, Boulder, CO 80304, Estados Unidos'
places_result = gmaps.places(place_name)
place_id = places_result['results'][0]['place_id']
Output
print(place['result']['place_id'])
ChIJFZ3Tw3vua4cRsd2Sia4hkLY
I want to get the same output but in the place_name I would like to get the telephone number and get the same place_id
place_result
{'html_attributions': [],
'results': [{'formatted_address': '3054 28th St, Boulder, CO 80301, USA',
'geometry': {'location': {'lat': 40.0301734, 'lng': -105.2578728},
'viewport': {'northeast': {'lat': 40.03152422989272,
'lng': -105.2566366201073},
'southwest': {'lat': 40.02882457010728, 'lng': -105.2593362798927}}},
'icon': 'https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/geocode-71.png',
'icon_background_color': '#7B9EB0',
'icon_mask_base_uri': 'https://maps.gstatic.com/mapfiles/place_api/icons/v2/generic_pinlet',
'name': '3054 28th St',
'place_id': 'ChIJs6f_tXvua4cRpmNh_22rOpc',
'plus_code': {'compound_code': '2PJR+3V Boulder, Colorado, USA',
'global_code': '85GP2PJR+3V'},
'reference': 'ChIJs6f_tXvua4cRpmNh_22rOpc',
'types': ['street_address']}],
'status': 'OK'}
If you would like to get the Place IDs based on phone numbers, you can use Places Find Place API.
Here’s an example:
The
inputshould be the phone numbers that are in international format (prefixed by a plus sign ("+"), followed by the country code, then the phone number itself. Next, usephonenumberas theinputtype. More information can be found here.If you want to get the phone number in the result, you can use Places Details API. You just need the Place ID of the place you want to search, and add
formatted_phone_numberor theinternational_phone_number. Here’s an example: