Beispiel #1
0
def fcmService(tipo):
    push_service = FCMNotification(api_key="AIzaSyCmvxnrqEFD5nwkH_n4RB-ItWLVFsYwCfI")

    if tipo == "1":
        global tipoHuella
        global EMAIL_CONTENT
        tipoHuella = "Acceso correcto, se accedio al hogar"
        EMAIL_CONTENT = tipoHuella
    elif tipo == "0":
        tipoHuella = "Acceso incorrecto, no se accedio al hogar"
        EMAIL_CONTENT = tipoHuella
    elif tipo == "2":
        tipoHuella = "Acceso incorrecto por tercera vez, el sistema se encuentra bloqueado"
        EMAIL_CONTENT = tipoHuella


    #:.........................................................................
    post = {"tipo": "huella",
            "estado": "\""+tipoHuella+"\""
            }
    posts = db.Piscina
    posts.insert_one(post).inserted_id
    #:.........................................................................

    topic_name = "Arqui1"
    message_title = "Modulo autorizacion"
    message_body = str(tipoHuella)
    low_priority = False
    content_available = True

    global payload
    payload = push_service.parse_payload(topic_name=topic_name,message_body=message_body,message_title=message_title,low_priority=low_priority,content_available=content_available)
    push_service.send_request([payload], timeout=4)
    print(payload)
    return tipoHuella