开机或登入时自动传Line讯息给我,如果有异常的时间点就表示有人偷开你的电脑了! ψ(`∇´)ψ
.py
转成 .exe
档.exe
档import datetime
import requests
import os
if __name__ == '__main__':
# 取得现在时刻
now = datetime.datetime.now()
now_str = now.strftime("%Y-%m-%d, %H:%M:%S")
# print(now_str)
try: # 如果有连网路则成功传送
if not os.path.exists("buffer.txt"): # 如果没有buffer.txt
with open("buffer.txt", "w") as f: # 建立新的
pass
with open("buffer.txt", "r") as file: # 读取buffer.txt
buffer = file.read()
# 建立讯息
message = "\n" + buffer
message += f"{now_str} [Successed]\n你的笔电在这些时段被登入了\n如果不是本人请多加留意!"
params = {"message": message}
# 权杖
headers = {
"Authorization": "Bearer " + "your token",
}
# 传送Line notify
r = requests.post("https://notify-api.line.me/api/notify",
headers=headers, params=params)
# 传送成功
with open("buffer.txt", "w") as f: # 清空buffer.txt
pass
with open("log.txt", "a") as file:
file.write(f"{now_str} [Successed]\n") # 记在log.txt中
except Exception as e: # 没连网路会跑出错误
with open("buffer.txt", "a") as file:
file.write(f"{now_str} [Failed]\n") # 记在buffer.txt中
with open("log.txt", "a") as file:
file.write(f"{now_str} [Failed]\n" + f"{e}\n") # 记在log.txt中
<<: Day10. 如何收拾需求变更的Boss,Blue Prism的降临 -BP改变流程Excel另存新档
>>: 10.unity摄影机跟随功能(Cinemachine)
在资讯化管理上,越来越多企业会选择使用透过集中化管理的方式,除了让资料尽可能让员工无法外流等资安考...
前言 走过了资料分析、演算法选择後, 我们得知了有些可以改善模型的方向: 解决资料不平衡 学习率的设...
各位夥伴好,今天我们要来介绍的是Django,Django是基於python写成的一种网页应用框架,...
这回写到的霍夫曼编码是在Algorithms Illuminated Part 3: Greedy ...
今天要来说明Angular专案内部各资料的功能 让我们从上往下讲吧 e2e: 端对端测试(end-t...