How to Validate a Street Address in Python

Determining the validity of street addresses is incredibly important in maintaining the integrity and reputation of a business.

Consider this example; a user purchases a product from your website but spells the street name incorrectly when entering it into the shipping information field. Now, when your shipping department is getting ready to send the product out, there is a possibility that it could go to the wrong address, or worse, not be delivered at all. Utilizing our Validate Street Address API on the front-end can save you from this sort of situation by immediately scanning the address for validity.

Image for post
Image for post

To use this API, we first need to install the SDK:

pip install cloudmersive-validate-api-client

Next, we can create an instance of the API and call the street validation function with the following code:

from __future__ import print_function
import time
import cloudmersive_validate_api_client
from cloudmersive_validate_api_client.rest import ApiException
from pprint import pprint

Once complete, the operation will return a response indicating the validity of the street address, as well as the longitude and latitude of the valid addresses. To receive a personal API key that gives you access to 800 calls/month, go to the Cloudmersive website and register for a free account.

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

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store