Beispiel #1
0
class Hip(object):
    def __init__(self):
        self.sms = Sms()

    def run(self):
        commands = ["inspire"]
        self.cli = CLI(self.process, commands)
        print self.cli.process()

    def process(self, *args):
        args = list(args)

        cmd = args.pop(0)
        if cmd == "inspire":
            self.inspire()
        else:
            raise HipError("Unrecognized command: %s" % cmd)

    def inspire(self):
        inspiration = Inspiration()
        quote = inspiration.getNext()
        print quote["quote"].encode("ascii", "replace")
        for soul in Folks().getActive():
            phone = soul["phonenumber"]
            print phone
            self.sms.send(phone, quote["quote"])
        inspiration.setSentDate(quote["id"], datetime.now())
Beispiel #2
0
    def get_weather_and_send_sms(self, conf):
        print '开启定时任务 %s.' % (datetime.now().strftime('%Y-%m-%d %H:%M:%S'))

        mobile = conf['mobile']
        weather_type = conf['weather_type']
        city = conf['city']

        weather = Weather(city)
        weather_str = weather.get_weather_str(weather_type)
        sms = Sms()
        sms.send_sms(mobile, city, weather_str)
Beispiel #3
0
def sendsmsoh(username,status):
    msg1=''
    print(status)
    if str(status).lower() == 'high':
       msg1="HIGH Value of Alcohol"
    elif str(status).lower() == 'low':
        msg1 ="Low value of Alcohol"
    elif str(status).lower() == "medium":
        msg1 ="Moderate Value of Alcohol"
       
    sms1 = Sms(msg=msg1,user=username)
    send_status =  sms1.Send()
    if send_status[0]:
            if mongo.MessageSaved(msg=msg1,user=username,status=True,time=send_status[1]) != None:
                return jsonify({'sent':msg1})
    else:
        return make_response(jsonify({"msg":msg1}),404)               
Beispiel #4
0
def Alarm(msg):
    from sms import Sms
    sms = Sms()
    global Alarm, MQTT_Client, MQTT_ClientID
    msg["alarm"] = True
    #publish msg
    MQTT_Client.publish(
        bytes(Mqtt_User + "/Alarm", "UTF-8"),
        bytes("{'data':'" + msg + ",'clientid':" + MQTT_ClientID + "}",
              "UTF-8"))
    for i in Phonenumbers:
        sms.send_msg(i, "SweetHome ALARM!!: \n alarm of type" + msg["data"])
    button = Pin(26, Pin.IN)
    while Alarm and not (button.value()):
        sleep(1)
        beeper = PWM(Pin(14, Pin.OUT), freq=440, duty=512)
        time.sleep(0.3)
        beeper.deinit()
        time.sleep(0.3)
Beispiel #5
0
def sendsms(username,status,speed):
    speed1 = int(speed)
    msg1=''
    print(status)
    if status == 'on':
        if speed1 >= 50 and speed1 <= 60:
            msg1 = "falldetected with moderate risk"
        elif speed1 > 60:
            msg1 = "falldetected with high risk"
        elif speed1 < 50:
            msg1 = "falldetected with low risk"
        print(speed1, msg1)
        sms1 = Sms(msg=msg1,user=username)
        send_status =  sms1.Send()
        if send_status[0]:
            if mongo.MessageSaved(msg=msg1,user=username,status=True,time=send_status[1]) != None:
                return jsonify({'sent':msg1})
        
    return make_response(jsonify({"msg":msg1}),404)
Beispiel #6
0
MOBILE = '09190734256'
EMAIL = '*****@*****.**'
SERVER_IP = 'https://salamat.mst-arman.ir'
UPLOAD_FOLDER = "static/uploads"
ACCESS_TOKEN_EXPIRE = datetime.timedelta(
    minutes=30)  # access token expiration time
CODE_TIME_EXPIRE = 150
parser = reqparse.RequestParser()
# parser.add_argument('fname', help = 'This field cannot be blank', required = True)
# parser.add_argument('password', help = 'This field cannot be blank', required = True)

telegram_token = '1065759842:AAFi_HnB_SzjgJC0bC0CjiPtsVS2pTENUyI'
telegram_chat_id = ['680596325', '652176141']
telegram_bot = Telegram(telegram_token, telegram_chat_id)

sms_panel = Sms()
redis_cli = redis.Redis()

logging.basicConfig(format='%s(asctime)s - %(message)s',
                    level=logging.DEBUG,
                    filename='logs/app.log')


class SubmitPhone(Resource):
    def post(self):
        parser_copy = parser.copy()

        parser_copy.add_argument('mphone',
                                 help='This field cannot be blank',
                                 required=True)
Beispiel #7
0
import requests, time
import random, os, codecs
from sys import exit

version = 2.01
set = [1, 0]
fav_phones = []
repo = "MaksPV/AresBomb-databases"

if os.path.isfile("sms.py") and os.path.isfile("calls.py"):
    from sms import Sms
    from calls import Calls
    
    Smss = Sms()
    Callss = Calls()
else:
    with codecs.open("sms.py", "w", encoding = 'utf8') as f:
        f.write(requests.get("https://raw.githubusercontent.com/" + repo + "/master/заглушка/sms.py").text)
    f.close()
    with codecs.open("calls.py", "w", encoding = 'utf8') as f:
        f.write(requests.get("https://raw.githubusercontent.com/" + repo + "/master/заглушка/calls.py").text)
    f.close()
    print("Запустите еще раз")
    exit()

if os.path.isfile("config.txt") != 1:
    with open('config.txt', 'w') as filehandle:  
        for listitem in set:
            filehandle.write('%s\n' % listitem)

if os.path.isfile("config.txt") == 1:
Beispiel #8
0
 def __init__(self):
     self.sms = Sms()