[Django]-Mail address validation in python/django

4👍

You can give a try to pygeocoder. It’s a Python wrapper for Google’s Geocoding V3 API. It can fulfill some of your validation needs.

from pygeocoder import Geocoder
g = Geocoder()
g.geocode("1 wellington, ottawa").valid_address
>>> True
g.geocode("1 wellington, chicago").valid_address
>>> False

It can take some minor misspelling too

result = g.geocode("1600 amphiteather, mountain view")
result.valid_address
>>> True
print result
>>> 1600 Amphitheatre Pkwy, Mountain View, CA 94043, USA
g.geocode("16000000 amphitheater, mountain view").valid_address
>>> False

But Google doesn’t always have the right postal/zip code. USPS has a public API for the US I believe.

disclamer: I made pygeocoder

👤xster

2👍

You could probably use a GeoCoding service (like Google’s) to verify that an address exists.

Leave a comment