Skip to content
This repository has been archived by the owner on Jan 20, 2022. It is now read-only.

www.cpdaily.com 访问不了导致脚本失效了 #27

Open
o0oo0ooo0 opened this issue Dec 9, 2020 · 6 comments
Open

www.cpdaily.com 访问不了导致脚本失效了 #27

o0oo0ooo0 opened this issue Dec 9, 2020 · 6 comments

Comments

@o0oo0ooo0
Copy link

www.cpdaily.com 访问不了导致脚本失效了

Traceback (most recent call last):

File "/opt/urllib3/util/connection.py", line 61, in create_connection

for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):

File "/var/lang/python3/lib/python3.6/socket.py", line 743, in getaddrinfo

for res in _socket.getaddrinfo(host, port, family, type, proto, flags):

socket.gaierror: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "/opt/urllib3/connectionpool.py", line 672, in urlopen

chunked=chunked,

File "/opt/urllib3/connectionpool.py", line 376, in _make_request

self._validate_conn(conn)

File "/opt/urllib3/connectionpool.py", line 994, in _validate_conn

conn.connect()

File "/opt/urllib3/connection.py", line 300, in connect

conn = self._new_conn()

File "/opt/urllib3/connection.py", line 169, in _new_conn

self, "Failed to establish a new connection: %s" % e

urllib3.exceptions.NewConnectionError: <urllib3.connection.VerifiedHTTPSConnection object at 0x7f88b19d3518>: Failed to establish a new connection: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "/opt/requests/adapters.py", line 449, in send

timeout=timeout

File "/opt/urllib3/connectionpool.py", line 720, in urlopen

method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]

File "/opt/urllib3/util/retry.py", line 436, in increment

raise MaxRetryError(_pool, url, error or ResponseError(cause))

urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='www.cpdaily.com', port=443): Max retries exceeded with url: /v6/config/guest/tenant/list (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f88b19d3518>: Failed to establish a new connection: [Errno -2] Name or service not known',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "/var/runtime/python3/bootstrap.py", line 176, in handle

ret = self.real_handler(event, context)

File "/var/user/index.py", line 323, in main_handler

raise e

File "/var/user/index.py", line 321, in main_handler

main()

File "/var/user/index.py", line 309, in main

apis = getCpdailyApis(user)

File "/var/user/index.py", line 50, in getCpdailyApis

schools = requests.get(url='https://www.cpdaily.com/v6/config/guest/tenant/list', verify=not debug).json()['data']

File "/opt/requests/api.py", line 76, in get

return request('get', url, params=params, **kwargs)

File "/opt/requests/api.py", line 61, in request

return session.request(method=method, url=url, **kwargs)

File "/opt/requests/sessions.py", line 530, in request

resp = self.send(prep, **send_kwargs)

File "/opt/requests/sessions.py", line 643, in send

r = adapter.send(request, **kwargs)

File "/opt/requests/adapters.py", line 516, in send

raise ConnectionError(e, request=request)

requests.exceptions.ConnectionError: HTTPSConnectionPool(host='www.cpdaily.com', port=443): Max retries exceeded with url: /v6/config/guest/tenant/list (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f88b19d3518>: Failed to establish a new connection: [Errno -2] Name or service not known',))

@ghost
Copy link

ghost commented Dec 9, 2020

能curl -v 一下吗,主机在国外吗

@ghost
Copy link

ghost commented Dec 9, 2020

俺国内的机子刚刚也签到失败了,没发给我微信,具体明早在看,蹲一波大神指点迷津

@ghost
Copy link

ghost commented Dec 10, 2020

schools = requests.get(url='https://mobile.campushoy.com/v6/config/guest/tenant/list', verify=not debug).json()['data']
把代码中两处的url修改一下即可

@UMRnInside
Copy link

或者手动添加 Hosts:

223.4.222.250 www.cpdaily.com

@o0oo0ooo0
Copy link
Author

schools = requests.get(url='https://mobile.campushoy.com/v6/config/guest/tenant/list', verify=not debug).json()['data']

把代码中两处的url修改一下即可

替换后可以正常使用了,我是放在国内腾讯云函数上面的

@o0oo0ooo0
Copy link
Author

或者手动添加 Hosts:

223.4.222.250 www.cpdaily.com

这个方法也有效果

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants