Exemplo n.º 1
0
def city_state_lookup(request):
    c = {}
    c.update(csrf(request))
    c.update({"city_state_active": "active"})

    if request.method == "GET":
        return render_to_response("city_state.html", c)
    elif request.method == "POST":
        form = CityStateForm(request.POST)
        if form.is_valid():
            addr = Address("", "", "", "", "", form.cleaned_data["zip5"], "", "")  # zip5  # zip4
            usps_connector = USPS([addr])
            usps_connector.make_city_state_lookup_request()

            c["address"] = addr

            return render_to_response("city_state_result.html", c)
        else:
            c.update({"form": form})
            return render_to_response("city_state.html", c)
Exemplo n.º 2
0
print addr.standardized_address_line2
print addr.standardized_city
print addr.standardized_state
print addr.standardized_zip5
print addr.standardized_zip4 
'''

addr = Address('',#firm name
               '', #address line1
               '', #address line2  
               '', #city
               '', #state
               '90210', 
               '',
               None,
               0)

usps_connector = USPS([addr])
usps_connector.make_city_state_lookup_request()

print addr.standardized_address_line1
print addr.standardized_address_line2
print addr.standardized_city
print addr.standardized_state
print addr.standardized_zip5
print addr.standardized_zip4