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

Function addressvalidation

googlemaps/addressvalidation.py:47–80  ·  view source on GitHub ↗

The Google Maps Address Validation API returns a verification of an address See https://developers.google.com/maps/documentation/address-validation/overview request must include parameters below. :param addressLines: The address to validate :type addressLines: array :param

(client, addressLines, regionCode=None , locality=None, enableUspsCass=None)

Source from the content-addressed store, hash-verified

45
46
47def addressvalidation(client, addressLines, regionCode=None , locality=None, enableUspsCass=None):
48 """
49 The Google Maps Address Validation API returns a verification of an address
50 See https://developers.google.com/maps/documentation/address-validation/overview
51 request must include parameters below.
52 :param addressLines: The address to validate
53 :type addressLines: array
54 :param regionCode: (optional) The country code
55 :type regionCode: string
56 :param locality: (optional) Restrict to a locality, ie:Mountain View
57 :type locality: string
58 :param enableUspsCass For the "US" and "PR" regions only, you can optionally enable the Coding Accuracy Support System (CASS) from the United States Postal Service (USPS)
59 :type locality: boolean
60 """
61
62 params = {
63 "address":{
64 "addressLines": addressLines
65 }
66 }
67
68 if regionCode is not None:
69 params["address"]["regionCode"] = regionCode
70
71 if locality is not None:
72 params["address"]["locality"] = locality
73
74 if enableUspsCass is not False or enableUspsCass is not None:
75 params["enableUspsCass"] = enableUspsCass
76
77 return client._request("/v1:validateAddress", {}, # No GET params
78 base_url=_ADDRESSVALIDATION_BASE_URL,
79 extract_body=_addressvalidation_extract,
80 post_json=params)
81

Callers

nothing calls this directly

Calls 1

_requestMethod · 0.80

Tested by

no test coverage detected