Skip to main content
This page demonstrates calling the Enhance Location endpoint to enrich a single address with Ping.Data. The examples show a simple GET-based call (query parameters) and a minimal Python script you can run locally. The code blocks allow the user to select from Python or cURL (via terminal) use cases. The sample Python script is available for download at the bottom of the page. Try filling in the blanks (e.g., {id}) to Enhance Location using cURL!

1. Enhance a Single Location

Example code:
enhance_location.py
import requests
import json
from pathlib import Path
import os

# authentication token that allows you to make requests to the API
API_KEY = os.environ.get('PING_DATA_AUTH_TOKEN')
headers = {"Authorization": f"Token {API_KEY}"}

# single-address example
params = {
    "address": "1600 pennsylvania ave nw washington dc 20500",
    "sources": ["PG", "PH"]
}

API_BASE = "https://data-api.sovfixer.com/api/v1"
url = f"{API_BASE}/enhance"
# 1. API URL for Enhance Location: https://data-api.sovfixer.com/api/v1/enhance
enhance_location_response = requests.get(url, headers=headers, params=params)
# check response status
if enhance_location_response.status_code not in (200, 201):
    print("Error:", enhance_location_response.status_code, enhance_location_response.text)
    raise Exception("Error enhancing location")

data = enhance_location_response.json()
print(json.dumps(data, indent=4))
Example response (truncated):
enhance_location.py
{'id': 'e92a9bbe-007b-11f1-bb2a-0242ac11000a',
 'location_data': {
                   'PG': {'address_line_1': '1600 Pennsylvania Ave NW',
                          'address_line_2': '',
                          'city': 'Washington',
                          ...

Python Demo

Download a ready-to-run Python demo of this workflow here:                                   Download Python Script here