我想在Python中的请求中传递IP地址而不是URL链接。
例如:传递IP地址而不是URL链接:
requests.get(url="172.217.168.228")
所以基本上是传递IP地址而不是URL链接。我该如何实现呢?
我猜我应该传递相关端口,但是怎么做呢?
我试了几件事情,但我得到了一堆错误,比如:
例如:传递IP地址而不是URL链接:
requests.get(url="172.217.168.228")
所以基本上是传递IP地址而不是URL链接。我该如何实现呢?
我猜我应该传递相关端口,但是怎么做呢?
我试了几件事情,但我得到了一堆错误,比如:
requests.exceptions.MissingSchema: Invalid URL '172.217.168.228': No schema supplied. Perhaps you meant http://172.217.168.228?
或者
File "/Users/ali/Desktop/cdn-detection/venv/lib/python3.9/site-packages/requests/adapters.py", line 514, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='172.217.168.228', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:1129)')))
或者
File "/Users/ali/Desktop/cdn-detection/venv/lib/python3.9/site-packages/requests/adapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='172.217.168.228.com', port=443): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f9be196a0a0>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known'))
"https://172.217.168.228"
。 - DisappointedByUnaccountableMod