Connect to Google API Geocoding failed: URLError: <urlopen error [Errno 10060]

120 views
Skip to first unread message

jenn...@gmail.com

unread,
Mar 29, 2016, 11:59:35 AM3/29/16
to codereview-discuss

I tried to use the code below to connect Google API Geocoding

import simplejson, urllib, urllib2

proxy_support = urllib2.ProxyHandler({"http":"www-myproxy"})
opener = urllib2.build_opener(proxy_support)
urllib2.install_opener(opener)

I got error as :

Traceback (most recent call last):
  File "V:\Geocode.py", line 35, in <module>
    html = urllib2.urlopen('https://maps.googleapis.com/maps/api/geocode/json?address=121+Dartmouth+Street+Boston+MA&key=Mykey')
  File "C:\Python27\lib\urllib2.py", line 154, in urlopen
    return opener.open(url, data, timeout)
  File "C:\Python27\lib\urllib2.py", line 431, in open
    response = self._open(req, data)
  File "C:\Python27\lib\urllib2.py", line 449, in _open
    '_open', req)
  File "C:\Python27\lib\urllib2.py", line 409, in _call_chain
    result = func(*args)
  File "C:\Python27\lib\urllib2.py", line 1240, in https_open
    context=self._context)
  File "C:\Python27\lib\urllib2.py", line 1197, in do_open
    raise URLError(err)
URLError: <urlopen error [Errno 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond>

I browsed through all the online discuss on this error, tried all kinds of solution worked out for other users. I still get the same error.
Not sure whether it is because of the company Firewall? Or the code has error?

Thanks
Reply all
Reply to author
Forward
0 new messages