#NEWLINE# def run( self ) : #NEWLINE# #INDENT# weather_xml = get_url ( 'http://forecast.weather.gov/MapClick.php?lat=40.71980&lon=-73.99300&FcstType=dwml' ) #NEWLINE# if ( weather_xml is None ) : #NEWLINE# #INDENT# send ( 'NYC Weather' , 'Sorry, this service is temporarily unavailable' , recipient_list = [ self . sender ] , sender = server_auto_email ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# doc = etree . fromstring ( weather_xml ) #NEWLINE# report = [ ] #NEWLINE# for elem in doc . xpath ( '//wordedForecast' ) : #NEWLINE# #INDENT# for subelem in elem . getchildren ( ) : #NEWLINE# #INDENT# if ( subelem . tag == 'text' ) : #NEWLINE# #INDENT# report . append ( subelem . text ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# send ( 'NYC Weather' , ' ' . join ( subelem ) , recipient_list = [ self . sender ] , sender = server_auto_email )