Geocode a Street Address in Python

Understanding where your clients are based will help you improve not only their experience, but also assist in your planning and marketing goals. For example, if many users are based in one region you can focus specific effort on outreach to that area. The following API will allow you to geocode a street address in Python. The input for this function should include the street address, city, state or province, postal code, and the country name and code.

Image for post
Image for post

Run 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

This will return whether the address was valid, as well as the latitude and longitude for its location. 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.

Written by

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