|
楼主 |
发表于 2024-4-20 17:07:06
|
显示全部楼层
我新找了个API
https://github.com/salikx/TheDivisionTab-API?tab=readme-ov-file
代码如下
import requests
def get_player_data(name, platform):
url = f"https://thedivisiontab.com/api/search.php?name={name}&platform={platform}/"
response = requests.get(url)
player_data = response.json()
#处理获取到的玩家数据
platform = input("请输入游戏平台:")
name = input("请输入玩家ID:")
get_player_data(name,platform)
正常的报错
C:\Users\25650\.conda\envs\kookbot\python.exe C:\Users\25650\PycharmProjects\kookbot\main.py
请输入游戏平台:uplay
请输入玩家ID:wkeer7
Traceback (most recent call last):
File "C:\Users\25650\.conda\envs\kookbot\lib\site-packages\urllib3\connection.py", line 198, in _new_conn
sock = connection.create_connection(
File "C:\Users\25650\.conda\envs\kookbot\lib\site-packages\urllib3\util\connection.py", line 60, in create_connection
for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
File "C:\Users\25650\.conda\envs\kookbot\lib\socket.py", line 918, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11001] getaddrinfo failed
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\25650\.conda\envs\kookbot\lib\site-packages\urllib3\connectionpool.py", line 793, in urlopen
response = self._make_request(
File "C:\Users\25650\.conda\envs\kookbot\lib\site-packages\urllib3\connectionpool.py", line 491, in _make_request
raise new_e
File "C:\Users\25650\.conda\envs\kookbot\lib\site-packages\urllib3\connectionpool.py", line 467, in _make_request
self._validate_conn(conn)
File "C:\Users\25650\.conda\envs\kookbot\lib\site-packages\urllib3\connectionpool.py", line 1099, in _validate_conn
conn.connect()
File "C:\Users\25650\.conda\envs\kookbot\lib\site-packages\urllib3\connection.py", line 616, in connect
self.sock = sock = self._new_conn()
File "C:\Users\25650\.conda\envs\kookbot\lib\site-packages\urllib3\connection.py", line 205, in _new_conn
raise NameResolutionError(self.host, self, e) from e
urllib3.exceptions.NameResolutionError: <urllib3.connection.HTTPSConnection object at 0x0000019C3D414BE0>: Failed to resolve 'thedivisiontab.com' ([Errno 11001] getaddrinfo failed)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\25650\.conda\envs\kookbot\lib\site-packages\requests\adapters.py", line 486, in send
resp = conn.urlopen(
File "C:\Users\25650\.conda\envs\kookbot\lib\site-packages\urllib3\connectionpool.py", line 847, in urlopen
retries = retries.increment(
File "C:\Users\25650\.conda\envs\kookbot\lib\site-packages\urllib3\util\retry.py", line 515, in increment
raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type]
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='thedivisiontab.com', port=443): Max retries exceeded with url: /api/search.php?name=wkeer7&platform=uplay/ (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x0000019C3D414BE0>: Failed to resolve 'thedivisiontab.com' ([Errno 11001] getaddrinfo failed)"))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\25650\PycharmProjects\kookbot\main.py", line 14, in <module>
get_player_data(name,platform)
File "C:\Users\25650\PycharmProjects\kookbot\main.py", line 6, in get_player_data
response = requests.get(url)
File "C:\Users\25650\.conda\envs\kookbot\lib\site-packages\requests\api.py", line 73, in get
return request("get", url, params=params, **kwargs)
File "C:\Users\25650\.conda\envs\kookbot\lib\site-packages\requests\api.py", line 59, in request
return session.request(method=method, url=url, **kwargs)
File "C:\Users\25650\.conda\envs\kookbot\lib\site-packages\requests\sessions.py", line 589, in request
resp = self.send(prep, **send_kwargs)
File "C:\Users\25650\.conda\envs\kookbot\lib\site-packages\requests\sessions.py", line 703, in send
r = adapter.send(request, **kwargs)
File "C:\Users\25650\.conda\envs\kookbot\lib\site-packages\requests\adapters.py", line 519, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='thedivisiontab.com', port=443): Max retries exceeded with url: /api/search.php?name=wkeer7&platform=uplay/ (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x0000019C3D414BE0>: Failed to resolve 'thedivisiontab.com' ([Errno 11001] getaddrinfo failed)"))
进程已结束,退出代码为 1
**上网的报错
C:\Users\25650\.conda\envs\kookbot\python.exe C:\Users\25650\PycharmProjects\kookbot\main.py
请输入游戏平台:uplay
请输入玩家ID:wkeer7
urllib3.exceptions.SSLError: TLS/SSL connection has been closed (EOF) (_ssl.c:1135)
The above exception was the direct cause of the following exception:
urllib3.exceptions.ProxyError: ('Unable to connect to proxy', SSLError(SSLZeroReturnError(6, 'TLS/SSL connection has been closed (EOF) (_ssl.c:1135)')))
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\25650\.conda\envs\kookbot\lib\site-packages\requests\adapters.py", line 486, in send
resp = conn.urlopen(
File "C:\Users\25650\.conda\envs\kookbot\lib\site-packages\urllib3\connectionpool.py", line 847, in urlopen
retries = retries.increment(
File "C:\Users\25650\.conda\envs\kookbot\lib\site-packages\urllib3\util\retry.py", line 515, in increment
raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type]
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='thedivisiontab.com', port=443): Max retries exceeded with url: /api/search.php?name=wkeer7&platform=uplay/ (Caused by ProxyError('Unable to connect to proxy', SSLError(SSLZeroReturnError(6, 'TLS/SSL connection has been closed (EOF) (_ssl.c:1135)'))))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\25650\PycharmProjects\kookbot\main.py", line 14, in <module>
get_player_data(name,platform)
File "C:\Users\25650\PycharmProjects\kookbot\main.py", line 6, in get_player_data
response = requests.get(url)
File "C:\Users\25650\.conda\envs\kookbot\lib\site-packages\requests\api.py", line 73, in get
return request("get", url, params=params, **kwargs)
File "C:\Users\25650\.conda\envs\kookbot\lib\site-packages\requests\api.py", line 59, in request
return session.request(method=method, url=url, **kwargs)
File "C:\Users\25650\.conda\envs\kookbot\lib\site-packages\requests\sessions.py", line 589, in request
resp = self.send(prep, **send_kwargs)
File "C:\Users\25650\.conda\envs\kookbot\lib\site-packages\requests\sessions.py", line 703, in send
r = adapter.send(request, **kwargs)
File "C:\Users\25650\.conda\envs\kookbot\lib\site-packages\requests\adapters.py", line 513, in send
raise ProxyError(e, request=request)
requests.exceptions.ProxyError: HTTPSConnectionPool(host='thedivisiontab.com', port=443): Max retries exceeded with url: /api/search.php?name=wkeer7&platform=uplay/ (Caused by ProxyError('Unable to connect to proxy', SSLError(SSLZeroReturnError(6, 'TLS/SSL connection has been closed (EOF) (_ssl.c:1135)'))))
进程已结束,退出代码为 1
|
|