added timeout and exepection handling for urlopen