import appuifw import e32 #------ # Program logic #------ import urllib import re import os def getRawWeatherForCity(city): tempfile = "c:\\weather_tempfile.xml" urllib.urlretrieve('http://www.google.com/ig/api?weather=%s' % city, tempfile) weather_file = open(tempfile) weather = weather_file.read() weather_file.close() urllib.urlcleanup() os.unlink(tempfile) return weather def getCurrentWeather(city): raw = getRawWeatherForCity(city) if raw.find('problem_cause') > 1: return None return Weather(raw) class struct: pass class Weather: _curRE = re.compile(r'.*(.*)<\/current_conditions>.*') _conditionRE = re.compile(r'.*.*') _tempRE = re.compile('.*