URL在浏览器里直接进行访问显示418,站点被攻击,访问被拦截。


关注让【道友老李】来帮你解答,本回答参考gpt编写,并整理提供,如果还有疑问可以点击头像关注私信或评论。
如果答案让您满意,请采纳、关注,非常感谢!这种情况可能是由于服务器防火墙对恶意攻击进行了拦截导致的。攻击者可能通过发送大量请求或者其他方式试图攻击站点,从而导致服务器的防火墙干预并返回状态码418,表示"I'm a teapot"。 针对这种情况,可以考虑以下几个解决方案:
import requests
import threading
def attack_site():
url = "http://your-website.com"
while True:
response = requests.get(url)
print(response.status_code)
# 开启多个线程模拟攻击
for i in range(10):
t = threading.Thread(target=attack_site)
t.start()