U
    ҭc
                     @   s*   d Z ddlmZ dZdd Zd	ddZdS )
z<Performs requests to the Google Maps Address Validation API.    )
exceptionsz(https://addressvalidation.googleapis.comc                 C   s   |   }|S )z
    Mimics the exception handling logic in ``client._get_body``, but
    for addressvalidation which uses a different response format.
    )json)responsebody r   Y/home/ubuntu/graampay/app_env/lib/python3.8/site-packages/googlemaps/addressvalidation.py_addressvalidation_extract   s    r   Nc                 C   s`   dd|ii}|dk	r ||d d< |dk	r4||d d< |dk	sD|dk	rL||d< | j di tt|d	S )
a  
    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 regionCode: (optional) The country code
    :type regionCode: string  
    :param locality: (optional) Restrict to a locality, ie:Mountain View
    :type locality: string
    :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)
    :type locality: boolean
    addressaddressLinesN
regionCodelocalityFenableUspsCassz/v1:validateAddress)Zbase_urlZextract_bodyZ	post_json)Z_request_ADDRESSVALIDATION_BASE_URLr   )Zclientr
   r   r   r   paramsr   r   r   addressvalidation/   s      r   )NNN)__doc__
googlemapsr   r   r   r   r   r   r   r   <module>   s   