再找短信 手机短信转发
第一反应想到 搞一个物联网模块 写一个短信转发,但是github有开源的app感觉还不错就不搞了
挺好用的
import re from time import time import requests headers = { "Content-Type:": "application/json; charset=utf-8" } memory = {} # 建议用redis def receiver(): data = { "data": { "type": 1, "page_num": 1, "page_size": 10, "keyword": "畅游", }, "timestamp": round(time() * 1000), "sign": "" } ret = requests.post(url="http://192.168.6.6:5000/sms/query", json=data).json() for li in ret['data']: number = li['number'] date = li['date'] content = li['content'] flag = exp.match(content) dit = time() - date / 1000 if not memory.get(date) and dit > 120: memory[date] = True if flag and not memory.get(date): sendmsg(number, flag.group('id')) memory[date] = True print(number, content) def sendmsg(phone, content): data = { "data": { "sim_slot": 1, # 1=SIM1, 2=SIM2 "phone_numbers": phone, "msg_content": content }, "timestamp": round(time() * 1000), "sign": "" } ret = requests.post(url="http://192.168.6.6:5000/sms/send", json=data).json() print(phone, ret) if __name__ == '__main__': exp = re.compile(".+10分钟.+?(?P<id>\d+)至.+") receiver()
https://github.com/pppscn/SmsForwarder 可以去给个star