我一直在尝试让我的不和谐机器人从一个网站上抓取一定数量的子域,并通过http.client过滤它们,通过请求检索响应为200OK的那些,这对google.com有效,但它会提供许多问题,我想知道有没有更有效和更快的方法来做到这一点?
global stripped_results
stripped_results = []
for tag in results:
connection = http.client.HTTPSConnection(tag)
connection.request("GET", "/")
response = connection.getresponse()
if (response.status, response.reason) == (200, "OK"):
stripped_results.append(tag)
else:
pass
connection.close()发布于 2021-04-04 03:44:19
我将使用请求库
import requests
r = requests.get("https://url.com/xyz") # alternative you can maybe use requests.post("url")https://stackoverflow.com/questions/66933864
复制相似问题