old_contents: #!/usr/bin/env python
  """
   Geocoder used by:
    - IEM Rainfall App
  $Id: $:
  """
  
  import xmlrpclib, cgi
  p = xmlrpclib.ServerProxy('http://rpc.geocoder.us/service/xmlrpc')
  
  
  def main():
  	form = cgi.FieldStorage()
  	res = []
  	if (form.has_key("address")):
  		res = p.geocode( form["address"].value )
  	if (form.has_key("street") and form.has_key("city") ):
  		address = "%s, %s" % (form["street"].value, form["city"].value)
  		res = p.geocode( address )
  	if (len(res) > 0 and res[0].has_key("lat") ):
  		print "%s,%s" % (res[0]["lat"], res[0]["long"])
  	else:
  		print "ERROR"
  
  print 'Content-type: text/plain \n'
  try:
  	main()
  except:
  	print "ERROR"
  	
  
new_contents: #!/usr/bin/env python
  """
   Geocoder used by:
    - IEM Rainfall App
  """
  import cgi
  import urllib
  import urllib2
  import sys
  import json
  
  def main():
      ''' Go main go '''
      form = cgi.FieldStorage()
      if form.has_key("address"):
          address = form["address"].value 
      elif form.has_key("street") and form.has_key("city"):
          address = "%s, %s" % (form["street"].value, form["city"].value)
  
      address = urllib.urlencode({'address': address})
      uri = ('http://maps.googleapis.com/maps/api/geocode/json'
                 +'?'+address+'&sensor=true')
      data = json.loads( urllib2.urlopen(uri).read() )
      if len(data['results']) > 0:    
          print "%s,%s" % (data['results'][0]['geometry']['location']['lat'],
                           data['results'][0]['geometry']['location']['lng'])
      else:
          sys.stderr.write( str(data) )
          print "ERROR"
  
  sys.stdout.write('Content-type: text/plain \n\n')
  try:
      main()
  except Exception, exp:
      sys.stderr.write(str(exp))
      print "ERROR"
  
subject: update geocoder to use google