File tree 1 file changed +2
-2
lines changed
1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change 2
2
from bs4 import BeautifulSoup as bs
3
3
import requests
4
4
5
- USER_AGENT = "Mozilla/5.0 (X11; Linux x86_64 ) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44 .0.2403.157 Safari/537.36"
5
+ USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64 ) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94 .0.4606.81 Safari/537.36"
6
6
# US english
7
7
LANGUAGE = "en-US,en;q=0.5"
8
8
@@ -35,7 +35,7 @@ def get_weather_data(url):
35
35
days = soup .find ("div" , attrs = {"id" : "wob_dp" })
36
36
for day in days .findAll ("div" , attrs = {"class" : "wob_df" }):
37
37
# extract the name of the day
38
- day_name = day .find ("div" , attrs = { "class" : "vk_lgy" }) .attrs ['aria-label' ]
38
+ day_name = day .findAll ("div" )[ 0 ] .attrs ['aria-label' ]
39
39
# get weather status for that day
40
40
weather = day .find ("img" ).attrs ["alt" ]
41
41
temp = day .findAll ("span" , {"class" : "wob_t" })
You can’t perform that action at this time.
0 commit comments