2

I can open the url:http://www.bloomberg.com/markets/chart/data/1M/AAPL:AR in my brower but my code here comes out the result:I/O error(socket error):[Errno 11004] getaddrinfo failed :

import urllib
import json
url='http://www.bloomberg.com/markets/chart/data/1M/AAPL:AR'
try:
    html_file=urllib.urlopen(url)
    html_text=html_file.read()
    data=json.load(html_text)
    data_points=data['data_values']
    for i in range(len(data_points)):
        print data_points[i]
except IOError as (errno,strerror):
    print "I/O error({0}):{1}".format(errno,strerror)
ray
  • 71
  • 3
  • 11
  • Does your browser use any kind of proxy settings for accessing the web? – Dave Challis Apr 24 '13 at 08:14
  • 2
    Oh,yes,I forgot that I lives on mainland of china,and I need not only a 'gogent'for chrome but also a VPN for application program to access to the outside world.Thank you for pointing out – ray Apr 24 '13 at 08:25

0 Answers0