标题: 关于免费教程查天气2的问题 [打印本页] 作者: noewuhd 时间: 2024-1-15 13:47 标题: 关于免费教程查天气2的问题 代码是复制过去的,导入了requests库,有一堆报错栈。
/data/user/0/org.qpython.qpy/files/bin/qpython3.sh "/storage/emulated/0/Android/data/org.qpython.qpy/files/.py" && exit
/ $ /data/user/0/org.qpython.qpy/files/bin/
qpython3.sh "/storage/emulated/0/Android/da
ta/org.qpython.qpy/files/.py" && exit
请输入城市,回车退出:
北京
Traceback (most recent call last):
File "/data/user/0/org.qpython.qpy/files/lib/python3.11/site-packages/urllib3/connection.py", line 203, in _new_conn
sock = connection.create_connection(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/user/0/org.qpython.qpy/files/lib/python3.11/site-packages/urllib3/util/connection.py", line 60, in create_connection
for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/user/0/org.qpython.qpy/files/lib/python3.11/socket.py", line 961, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
socket.gaierror: [Errno 7] No address associated with hostname
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/data/user/0/org.qpython.qpy/files/lib/python3.11/site-packages/urllib3/connectionpool.py", line 790, in urlopen
response = self._make_request(
^^^^^^^^^^^^^^^^^^^
File "/data/user/0/org.qpython.qpy/files/lib/python3.11/site-packages/urllib3/connectionpool.py", line 496, in _make_request
conn.request(
File "/data/user/0/org.qpython.qpy/files/lib/python3.11/site-packages/urllib3/connection.py", line 395, in request
self.endheaders()
File "/data/user/0/org.qpython.qpy/files/lib/python3.11/http/client.py", line 1277, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/data/user/0/org.qpython.qpy/files/lib/python3.11/http/client.py", line 1037, in _send_output
self.send(msg)
File "/data/user/0/org.qpython.qpy/files/lib/python3.11/http/client.py", line 975, in send
self.connect()
File "/data/user/0/org.qpython.qpy/files/lib/python3.11/site-packages/urllib3/connection.py", line 243, in connect
self.sock = self._new_conn()
^^^^^^^^^^^^^^^^
File "/data/user/0/org.qpython.qpy/files/lib/python3.11/site-packages/urllib3/connection.py", line 210, in _new_conn
raise NameResolutionError(self.host, self, e) from e
urllib3.exceptions.NameResolutionError: <urllib3.connection.HTTPConnection object at 0x787357f790>: Failed to resolve 'wthrcdn.etouch.cn' ([Errno 7] No address associated with hostname)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/data/user/0/org.qpython.qpy/files/lib/python3.11/site-packages/requests/adapters.py", line 486, in send
resp = conn.urlopen(
^^^^^^^^^^^^^
File "/data/user/0/org.qpython.qpy/files/lib/python3.11/site-packages/urllib3/connectionpool.py", line 844, in urlopen
retries = retries.increment(
^^^^^^^^^^^^^^^^^^
File "/data/user/0/org.qpython.qpy/files/lib/python3.11/site-packages/urllib3/util/retry.py", line 515, in increment
raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='wthrcdn.etouch.cn', port=80): Max retries exceeded with url: /weather_mini?city=%E5%8C%97%E4%BA%AC (Caused by NameResolutionError("<urllib3.connection.HTTPConnection object at 0x787357f790>: Failed to resolve 'wthrcdn.etouch.cn' ([Errno 7] No address associated with hostname)"))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/storage/emulated/0/Android/data/org.qpython.qpy/files/.py", line 6, in <module>
req = requests.get('http://wthrcdn.etouch.cn/weather_mini?city=%s' % city)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/user/0/org.qpython.qpy/files/lib/python3.11/site-packages/requests/api.py", line 73, in get
return request("get", url, params=params, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/user/0/org.qpython.qpy/files/lib/python3.11/site-packages/requests/api.py", line 59, in request
return session.request(method=method, url=url, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/user/0/org.qpython.qpy/files/lib/python3.11/site-packages/requests/sessions.py", line 589, in request
resp = self.send(prep, **send_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/user/0/org.qpython.qpy/files/lib/python3.11/site-packages/requests/sessions.py", line 703, in send
r = adapter.send(request, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/user/0/org.qpython.qpy/files/lib/python3.11/site-packages/requests/adapters.py", line 519, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='wthrcdn.etouch.cn', port=80): Max retries exceeded with url: /weather_mini?city=%E5%8C%97%E4%BA%AC (Caused by NameResolutionError("<urllib3.connection.HTTPConnection object at 0x787357f790>: Failed to resolve 'wthrcdn.etouch.cn' ([Errno 7] No address associated with hostname)"))
/ $作者: noewuhd 时间: 2024-1-15 13:48
有大佬知道是什么问题吗?网站也这个网站我也无法访问。作者: crossin先生 时间: 2024-1-15 23:57
原接口无效了。