File tree 1 file changed +8
-8
lines changed
apps/05_weather_client/final
1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -49,16 +49,16 @@ def get_html_from_web(zipcode):
49
49
50
50
51
51
def get_weather_from_html (html ):
52
- # cityCss = 'div#location h1'
53
- # weatherConditionCss = 'div#curCond span.wx-value '
54
- # weatherTempCss = 'div#curTemp span.wx-data span.wx -value'
55
- # weatherScaleCss = 'div#curTemp span.wx-data span.wx-unit '
52
+ # cityCss = '.region-content-header h1'
53
+ # weatherScaleCss = '.wu-unit-temperature .wu-label '
54
+ # weatherTempCss = '.wu-unit-temperature .wu -value'
55
+ # weatherConditionCss = '.condition-icon '
56
56
57
57
soup = bs4 .BeautifulSoup (html , 'html.parser' )
58
- loc = soup .find (id = 'location ' ).find ('h1' ).get_text ()
59
- condition = soup .find (id = 'curCond' ). find ( class_ = 'wx-value ' ).get_text ()
60
- temp = soup .find (id = 'curTemp ' ).find (class_ = 'wx -value' ).get_text ()
61
- scale = soup .find (id = 'curTemp ' ).find (class_ = 'wx-unit ' ).get_text ()
58
+ loc = soup .find (class_ = 'region-content-header ' ).find ('h1' ).get_text ()
59
+ condition = soup .find (class_ = 'condition-icon ' ).get_text ()
60
+ temp = soup .find (class_ = 'wu-unit-temperature ' ).find (class_ = 'wu -value' ).get_text ()
61
+ scale = soup .find (class_ = 'wu-unit-temperature ' ).find (class_ = 'wu-label ' ).get_text ()
62
62
63
63
loc = cleanup_text (loc )
64
64
loc = find_city_and_state_from_location (loc )
You can’t perform that action at this time.
0 commit comments