AlexBlock
AlexBlock 3 天前

1500Get!
感谢支持!

AlexBlock
AlexBlock 6 天前

30get纪念一下

AlexBlock
AlexBlock 8 天前

正在写后端api,有没有什么好方法限速?fastapi的那个我不知道为啥就是弄不好。。

附带一个大神解法:

def check_ip(ip):
with open("get_count.csv") as file:
    lines = file.readlines()[-50:]  # 从后往前搜索最近的50行
    for line in reversed(lines):
        data = line.strip().split(',')
        if data[0] == ip:
            timestamp = datetime.strptime(data[1], '%Y-%m-%d %H:%M:%S')
            current_time = datetime.now()
            time_difference = (current_time - timestamp).total_seconds()
            if time_difference < 10:
                return False
            else:
                return True
    return True
AlexBlock
AlexBlock 21 天前

珍爱api远离不关闭数据库连接

AlexBlock
AlexBlock 04-09

宝塔建的那B数据库怎么都连不上🤬
无语了奥

Theme Jasmine by Kent Liao