Normalize a Street Address in Python

When inputting addresses into a program or spreadsheet, it can be tedious to pull out each piece by hand. The following API will parse, normalize, and validate a street address instantly. If the address is valid, it will also return the latitude and longitude for the location.

You can use this API by running this command to install the SDK:

pip install cloudmersive-validate-api-client

Then, you can call the function:

from __future__ import print_function
import time
import cloudmersive_validate_api_client
from cloudmersive_validate_api_client.rest import ApiException
from pprint import pprint
# Configure API key authorization: Apikey
configuration = cloudmersive_validate_api_client.Configuration()
configuration.api_key['Apikey'] = 'YOUR_API_KEY'
# create an instance of the API class
api_instance = cloudmersive_validate_api_client.AddressApi(cloudmersive_validate_api_client.ApiClient(configuration))
input = cloudmersive_validate_api_client.ValidateAddressRequest() # ValidateAddressRequest | Input parse request
try:
# Normalize a street address
api_response = api_instance.address_normalize_address(input)
pprint(api_response)
except ApiException as e:
print("Exception when calling AddressApi->address_normalize_address: %s\n" % e)

This will return objects containing the building type, street number, street, city, state or province, postal code, country name and code, and the latitude and longitude. You can retrieve the API Key from the Cloudmersive website at no cost and with no commitment. This will provide you with 800 monthly calls across our library of APIs.

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.