---------------------------------------------------------------------------
TimeoutError Traceback (most recent call last)
c:\users\张成悟\appdata\local\programs\python\python36\lib\site-packages\urllib3\connection.py in _new_conn(self)
140 conn = connection.create_connection(
--> 141 (self.host, self.port), self.timeout, **extra_kw)
142
c:\users\张成悟\appdata\local\programs\python\python36\lib\site-packages\urllib3\util\connection.py in create_connection(address, timeout, source_address, socket_options)
82 if err is not None:
---> 83 raise err
84
c:\users\张成悟\appdata\local\programs\python\python36\lib\site-packages\urllib3\util\connection.py in create_connection(address, timeout, source_address, socket_options)
72 sock.bind(source_address)
---> 73 sock.connect(sa)
74 return sock
TimeoutError: [WinError 10060] 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。
During handling of the above exception, another exception occurred:
NewConnectionError Traceback (most recent call last)
c:\users\张成悟\appdata\local\programs\python\python36\lib\site-packages\urllib3\connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)
599 body=body, headers=headers,
--> 600 chunked=chunked)
601
c:\users\张成悟\appdata\local\programs\python\python36\lib\site-packages\urllib3\connectionpool.py in _make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw)
355 else:
--> 356 conn.request(method, url, **httplib_request_kw)
357
c:\users\张成悟\appdata\local\programs\python\python36\lib\http\client.py in request(self, method, url, body, headers, encode_chunked)
1238 """Send a complete request to the server."""
-> 1239 self._send_request(method, url, body, headers, encode_chunked)
1240
c:\users\张成悟\appdata\local\programs\python\python36\lib\http\client.py in _send_request(self, method, url, body, headers, encode_chunked)
1284 body = _encode(body, 'body')
-> 1285 self.endheaders(body, encode_chunked=encode_chunked)
1286
c:\users\张成悟\appdata\local\programs\python\python36\lib\http\client.py in endheaders(self, message_body, encode_chunked)
1233 raise CannotSendHeader()
-> 1234 self._send_output(message_body, encode_chunked=encode_chunked)
1235
c:\users\张成悟\appdata\local\programs\python\python36\lib\http\client.py in _send_output(self, message_body, encode_chunked)
1025 del self._buffer[:]
-> 1026 self.send(msg)
1027
c:\users\张成悟\appdata\local\programs\python\python36\lib\http\client.py in send(self, data)
963 if self.auto_open:
--> 964 self.connect()
965 else:
c:\users\张成悟\appdata\local\programs\python\python36\lib\site-packages\urllib3\connection.py in connect(self)
165 def connect(self):
--> 166 conn = self._new_conn()
167 self._prepare_conn(conn)
c:\users\张成悟\appdata\local\programs\python\python36\lib\site-packages\urllib3\connection.py in _new_conn(self)
149 raise NewConnectionError(
--> 150 self, "Failed to establish a new connection: %s" % e)
151
NewConnectionError: <urllib3.connection.HTTPConnection object at 0x000001F77A058358>: Failed to establish a new connection: [WinError 10060] 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。
During handling of the above exception, another exception occurred:
MaxRetryError Traceback (most recent call last)
c:\users\张成悟\appdata\local\programs\python\python36\lib\site-packages\requests\adapters.py in send(self, request, stream, timeout, verify, cert, proxies)
439 retries=self.max_retries,
--> 440 timeout=timeout
441 )
c:\users\张成悟\appdata\local\programs\python\python36\lib\site-packages\urllib3\connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)
648 retries = retries.increment(method, url, error=e, _pool=self,
--> 649 _stacktrace=sys.exc_info()[2])
650 retries.sleep()
c:\users\张成悟\appdata\local\programs\python\python36\lib\site-packages\urllib3\util\retry.py in increment(self, method, url, response, error, _pool, _stacktrace)
387 if new_retry.is_exhausted():
--> 388 raise MaxRetryError(_pool, url, error or ResponseError(cause))
389
MaxRetryError: HTTPConnectionPool(host='api.map.baidu.com', port=80): Max retries exceeded with url: /geocoder/v2/?address=%E6%B0%AA%E6%98%9F%E7%90%83&ak=Pt15VZ8Msk0fjKO4SXLUD58CiwbOOZ0P&output=json (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000001F77A058358>: Failed to establish a new connection: [WinError 10060] 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。',))
During handling of the above exception, another exception occurred:
ConnectionError Traceback (most recent call last)
<ipython-input-34-6177ddffa865> in <module>()
3 templist = list(set(locationslist))
4 for loc in templist:
----> 5 coord_dict[loc] = get_coord(loc)
<ipython-input-28-1697b5a66be6> in get_coord(address)
4 """
5 response = requests.get('http://api.map.baidu.com/geocoder/v2/?address=' + address
----> 6 + '&ak=' + AKEY + '&output=json')
7 address_dict = json.loads(response.text)
8 return address_dict
c:\users\张成悟\appdata\local\programs\python\python36\lib\site-packages\requests\api.py in get(url, params, **kwargs)
70
71 kwargs.setdefault('allow_redirects', True)
---> 72 return request('get', url, params=params, **kwargs)
73
74
c:\users\张成悟\appdata\local\programs\python\python36\lib\site-packages\requests\api.py in request(method, url, **kwargs)
56 # cases, and look like a memory leak in others.
57 with sessions.Session() as session:
---> 58 return session.request(method=method, url=url, **kwargs)
59
60
c:\users\张成悟\appdata\local\programs\python\python36\lib\site-packages\requests\sessions.py in request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)
511 }
512 send_kwargs.update(settings)
--> 513 resp = self.send(prep, **send_kwargs)
514
515 return resp
c:\users\张成悟\appdata\local\programs\python\python36\lib\site-packages\requests\sessions.py in send(self, request, **kwargs)
621
622 # Send the request
--> 623 r = adapter.send(request, **kwargs)
624
625 # Total elapsed time of the request (approximately)
c:\users\张成悟\appdata\local\programs\python\python36\lib\site-packages\requests\adapters.py in send(self, request, stream, timeout, verify, cert, proxies)
502 raise ProxyError(e, request=request)
503
--> 504 raise ConnectionError(e, request=request)
505
506 except ClosedPoolError as e:
ConnectionError: HTTPConnectionPool(host='api.map.baidu.com', port=80): Max retries exceeded with url: /geocoder/v2/?address=%E6%B0%AA%E6%98%9F%E7%90%83&ak=Pt15VZ8Msk0fjKO4SXLUD58CiwbOOZ0P&output=json (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000001F77A058358>: Failed to establish a new connection: [WinError 10060] 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。',))