Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- query = query.replace('!', '')
- query = web.quote(query)
- uri = 'http://api.wunderground.com/api/' + phenny.config.wunderground_api_key + '/conditions/q/' + query + '.json'
- rec_bytes = web.get(uri)
- jsonstring = json.loads(rec_bytes)
- werror = 0
- try
- werrorexist = jsonstring['response']['error']['type']
- werror = 1
- except
- werror = 0
- if werror is 1:
- werrortype = jsonstring['response']['error']['type']
- werrordesc = jsonstring['response']['error']['description']
- werrorfull = werrortype + ' - ' + werrordesc
- return werrorfull
Advertisement
Add Comment
Please, Sign In to add comment