The USPS shipping validation API changed the structure of return values, breaking the code in
|
def validate(addr_dict, credentials): |
A revision would look something like this, where v is the validated address json returned by the call to usps.validate_address():
try:
v_addr = v['AddressValidateResponse']['Address']
if v_addr['Zip4'] != None:
zip_code = '{}-{}'.format(v_addr['Zip5'], v_addr['Zip4'])
else:
zip_code = v_addr['Zip5']
reformat_rentals.append(
{
'address': v_addr['Address2'],
'city': v_addr['City'],
'zip_code': zip_code,
'original': v['original']
}
)
except KeyError:
print(f'Unable to parse {v}')
The USPS shipping validation API changed the structure of return values, breaking the code in
geocode-tools/geocodetools/address_validator.py
Line 28 in d65bb74
A revision would look something like this, where
vis the validated address json returned by the call tousps.validate_address():