【发布时间】:2021-06-30 04:25:14
【问题描述】:
我一直试图让我的不和谐机器人从它抓取的网站中获取一定数量的子域,并通过请求检索以 200 OK 响应的子域并使用 http.client 过滤它们,这适用于 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()
【问题讨论】:
-
这里没有真正的问题,但Requests是python最常用的HTTP库。
-
是的,谢谢你更快@F.Gyllenhammar
标签: python discord.py http.client