1 import urllib.request 2 import urllib.error 3 4 url = 'http://c.telunyun.com/Chart/getJsonData?market=1' 5 data = urllib.request.Request(url) 6 try: 7 data = urllib.request.urlopen(data) 8 print(data.read().decode('utf-8')) 9 except urllib.error.URLError as e: 10 print (e.code) 11 print (e.read().decode('utf-8'))