Install & Compatibility
Where this runs
tested against v0.5.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.910 runs
installs and imports cleanly · install 0.0s · import 0.631s · 21.8MB
glibcpy 3.10–3.910 runs
installs and imports cleanly · install 2.2s · import 0.569s · 22MB
20MB installed
● package 20MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
CensusGeocode
✓ from censusgeocode import CensusGeocode
geocode
✓ import censusgeocode
censusgeocode.geocode(...)
This example demonstrates how to initialize the `CensusGeocode` client and perform both single address and batch geocoding. The US Census Geocoder API typically does not require an API key for public use.
import censusgeocode
# Initialize the geocoder client
cg = censusgeocode.CensusGeocode()
# Geocode a single address
single_address_result = cg.address(
street="123 Main St",
city="Anytown",
state="CA",
zipcode="90210"
)
print(f"Single address result: {single_address_result}")
# Prepare addresses for batch geocoding
# The Census Geocoder public API generally does not require an API key.
batch_addresses = [
{"id": 1, "street": "123 Main St", "city": "Anytown", "state": "CA", "zipcode": "90210"},
{"id": 2, "street": "456 Oak Ave", "city": "Someville", "state": "NY", "zipcode": "10001"}
]
# Geocode a batch of addresses
batch_result = cg.addressbatch(batch_addresses)
print(f"Batch address result: {batch_result}")
Errors
Common errors & fixes
urllib.error.URLError: <urlopen error [Errno 111] Connection refused>
Older versions of `censusgeocode` (prior to 0.5.3) could encounter `urllib.error.URLError` or similar connection issues due to underlying HTTP library usage, especially in specific network environments or with certain TLS/SSL configurations.
fixUpgrade `censusgeocode` to version 0.5.3 or newer to benefit from fixes addressing these connection stability issues: `pip install --upgrade censusgeocode`.
TypeError: 'NoneType' object is not subscriptable
Users of `censusgeocode` versions older than `0.4.3.post1` might encounter `TypeError` when attempting to process results from `addressbatch` calls, particularly in certain Python versions, due to a bug in parsing malformed or empty responses.
fixUpgrade `censusgeocode` to version `0.4.3.post1` or newer: `pip install --upgrade censusgeocode`. This version includes a fix for parsing `addressbatch` results.
Upgrade
Version history
0.5.3latest on PyPI · released Feb 8, 2026
Audit
Dependencies
requestsrequiredUsed for making HTTP requests to the Census Geocoder API.