@response_server.route('/weather/', methods=['GET', 'POST'])
def weather():
    # Get destination from url query string:
    # 'node' : destination
    # 'Digits' : input digits from user
    if request.method == 'POST':
        dtmf = request.form.get('Digits', -1)
    else:
        dtmf = -1
    try:
        dtmf = int(dtmf)
    except __HOLE__:
        dtmf = -1
    
    zipcode = str(dtmf)
    zipcode = zipcode.replace('#', '').replace('*', '')[:5]
    if len(zipcode)!=5: #todo check zipcode format
        r = plivohelper.Response()
        r.addSpeak("Invalid Zipcode")
    else:
        print "zipcode %s" % zipcode
        r = plivohelper.Response()
        xml_weather = fetch_weather(zipcode)
        if xml_weather and xml_weather.find('City not found')==-1:
            weather = parse(xml_weather)
            r.addSpeak("It is currently %s degrees fahrenheit and %s in %s." %
                (weather['temp'], weather['conditions'], weather['location']))
        else:
            r.addSpeak("Error getting the weather forecast for zipcode %s." %
                zipcode)

    print "RESTXML Response => %s" % r
    return render_template('response_template.xml', response=r)
dataset/ETHPy150Open plivo/plivohelper-python/examples/weatherbyphone/weather.py/weather