Python 访问网址的错误报告

python 遇到的错误报告
源码:
import urllib.request
response = urllib.request.urlopen('http:// / context/ f64710b4861e6ff10678036548bf7afa')
html = response.read()
print(html)

Traceback (most recent call last):
File "E:\python\lib\urllib\request.py", line 1346, in do_open
h.request(req.get_method(), req.selector, req.data, headers,
File "E:\python\lib\http\client.py", line 1285, in request
self._send_request(method, url, body, headers, encode_chunked)
File "E:\python\lib\http\client.py", line 1331, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "E:\python\lib\http\client.py", line 1280, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "E:\python\lib\http\client.py", line 1040, in _send_output
self.send(msg)
File "E:\python\lib\http\client.py", line 980, in send
self.connect()
File "E:\python\lib\http\client.py", line 946, in connect
self.sock = self._create_connection(
File "E:\python\lib\socket.py", line 823, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
File "E:\python\lib\socket.py", line 954, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11001] getaddrinfo failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "", line 1, in
File "E:\python\lib\urllib\request.py", line 214, in urlopen
return opener.open(url, data, timeout)
File "E:\python\lib\urllib\request.py", line 517, in open
response = self._open(req, data)
File "E:\python\lib\urllib\request.py", line 534, in _open
result = self._call_chain(self.handle_open, protocol, protocol +
File "E:\python\lib\urllib\request.py", line 494, in _call_chain
result = func(*args)
File "E:\python\lib\urllib\request.py", line 1375, in http_open
return self.do_open(http.client.HTTPConnection, req)
File "E:\python\lib\urllib\request.py", line 1349, in do_open
raise URLError(err)
urllib.error.URLError:

html = response.read()
Traceback (most recent call last):
File "", line 1, in
NameError: name 'response' is not defined
print(html)

错误这么多 哪位可以帮看一下么 多谢多谢

img


这个链接是不是写错了??

链接在浏览器中能访问吗,中间是不是多空格,少ip,端口 或者域名

img


说你没有response这个变量?
你在跑一下呢