MCPcopy Index your code
hub / github.com/googlemaps/google-maps-services-python / find_place

Function find_place

googlemaps/places.py:127–195  ·  view source on GitHub ↗

A Find Place request takes a text input, and returns a place. The text input can be any kind of Places data, for example, a name, address, or phone number. :param input: The text input specifying which place to search for (for example, a name, address, or phone nu

(
    client, input, input_type, fields=None, location_bias=None, language=None
)

Source from the content-addressed store, hash-verified

125
126
127def find_place(
128 client, input, input_type, fields=None, location_bias=None, language=None
129):
130 """
131 A Find Place request takes a text input, and returns a place.
132 The text input can be any kind of Places data, for example,
133 a name, address, or phone number.
134
135 :param input: The text input specifying which place to search for (for
136 example, a name, address, or phone number).
137 :type input: string
138
139 :param input_type: The type of input. This can be one of either 'textquery'
140 or 'phonenumber'.
141 :type input_type: string
142
143 :param fields: The fields specifying the types of place data to return. For full details see:
144 https://developers.google.com/places/web-service/search#FindPlaceRequests
145 :type fields: list
146
147 :param location_bias: Prefer results in a specified area, by specifying
148 either a radius plus lat/lng, or two lat/lng pairs
149 representing the points of a rectangle. See:
150 https://developers.google.com/places/web-service/search#FindPlaceRequests
151 :type location_bias: string
152
153 :param language: The language in which to return results.
154 :type language: string
155
156 :rtype: result dict with the following keys:
157 status: status code
158 candidates: list of places
159 """
160 params = {"input": input, "inputtype": input_type}
161
162 if input_type != "textquery" and input_type != "phonenumber":
163 raise ValueError(
164 "Valid values for the `input_type` param for "
165 "`find_place` are 'textquery' or 'phonenumber', "
166 "the given value is invalid: '%s'" % input_type
167 )
168
169 if fields:
170 deprecated_fields = set(fields) & DEPRECATED_FIELDS
171 if deprecated_fields:
172 warnings.warn(
173 DEPRECATED_FIELDS_MESSAGE % str(list(deprecated_fields)),
174 DeprecationWarning,
175 )
176
177 invalid_fields = set(fields) - PLACES_FIND_FIELDS
178 if invalid_fields:
179 raise ValueError(
180 "Valid values for the `fields` param for "
181 "`find_place` are '%s', these given field(s) "
182 "are invalid: '%s'"
183 % ("', '".join(PLACES_FIND_FIELDS), "', '".join(invalid_fields))
184 )

Callers

nothing calls this directly

Calls 1

_requestMethod · 0.80

Tested by

no test coverage detected