Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions weather.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ def weather_response(location, API_key):#Function for getting the json string
url =urllib.request.urlopen('url till location'+location+'&APPID='+API_key)
json = url.read()#.decode('utf-8')
return str(json)
def has_error(json,location):
def has_error(json,location): #has error or not
json=str(json)
if json == str(b'{"cod":"404","message":"city not found"}'):
print("error 404,city not found")
Expand Down Expand Up @@ -78,4 +78,4 @@ def get_wind(json,n=0,t='03:00:00'):
finding_comma = sliced_1.find(',',wind_index)
wind = sliced_1[wind_index:finding_comma]
wind = float(wind)
return wind
return wind