使用python从FQDN获取url

2024-09-29 23:21:35 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个FQDN列表,需要使用python获取它指向的url。有没有关于我如何做到这一点的建议

根据@tetech的建议添加了http://它给出了以下错误:

requests.exceptions.ConnectionError: HTTPConnectionPool(host='edge-mqtt-shv-01-any2.facebook.com', port=80): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f9b534ad7f0>: Failed to establish a new connection: [Errno 111] Connection refused',)

使用此代码:

import requests
requests.get("http://edge-mqtt-shv-01-any2.facebook.com")

Tags: comhttpurl列表facebookconnectionrequestsmqtt

热门问题