alinahid477 / python-weather-api

Automatically exported from code.google.com/p/python-weather-api
MIT License
0 stars 0 forks source link

patch - handle exception for urlopen #15

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
any error in urllib2.urlopen (DNS, etc.)

What is the expected output? What do you see instead?
expect empty data, not error
where to handle exception? in pywapi x outside

What version of the product are you using? On what operating system?
version 0.22

Please provide any additional information below.

old code:
handler = urllib2.urlopen(url)

new code:
try: handler = urllib2.urlopen(url)
except urllib2.URLError: return {}

or:
try: handler = urllib2.urlopen(url)
except: return {}

Original issue reported on code.google.com by jan.no...@topinfo.cz on 7 Feb 2011 at 9:30

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r115.

Original comment by jtas...@gmail.com on 9 Mar 2013 at 6:02