Esempio n. 1
0
import time
from sinchsms import SinchSMS
number = '7557462911'
message = "hi"
client = SinchSMS("b2557e0e-1512-4953-a99b-c543d96f9a94",
                  "RnEHiZmMBEOmIrdvrbx2mg==")
print("sending '%s' to %s " (message, number))
response = client.send_message(number, message)
Esempio n. 2
0
import time 
from time import sleep 
from sinchsms import SinchSMS 

number = '918826022510'
app_key = 'e31dabc6-aa8d-46bb-aab8-bfb91b58d13c'
app_secret = 'J7js1xm+m0665hYgrzW6+w=='

# enter the message to be sent 
message = 'Alert Triggered'

client = SinchSMS(app_key, app_secret) 
print("Sending '%s' to %s" % (message, number)) 

response = client.send_message(number, message) 
message_id = response['messageId'] 
response = client.check_status(message_id) 

# keep trying unless the status retured is Successful 
while response['status'] != 'Successful': 
    print(response['status']) 
    time.sleep(1) 
    response = client.check_status(message_id) 

print(response['status'])
Esempio n. 3
0
import time
from sinchsms import SinchSMS

number = '+917001354181'
message = 'I love SMS!'

client = SinchSMS('7d4d335a8f924bb3903427b74355a0a1',
                  'f5cce5c3f91e4feba2df74a31ffb4bd3')
print("Sending '%s' to %s" % (message, number))
response = client.send_message(number, message)
message_id = response['messageId']

response = client.check_status(message_id)
while response['status'] != 'Successful':
    print(response['status'])
    time.sleep(1)
    response = client.check_status(message_id)
    print(response['status'])
Esempio n. 4
0
    get_updates = json.loads(requests.get(url + 'getUpdates').content)
    for update in get_updates['result']:
        if last_update < update['update_id']:
            last_update = update['update_id']
            file = open('last_update_sms.txt', 'w')
            pickle.dump(last_update, file)
            file.close()
            print(update['message']['text'])
            try:
                if u'/start' in update['message']['text']:
                    help_bot = u'Olá\nPara enviar um SMS digite /enviarSMS 11999999999 Olá Tudo Bem?'
                    requests.get(url + 'sendMessage',
                                 params=dict(
                                     chat_id=update['message']['chat']['id'],
                                     text=help_bot))
                if u'/enviarSMS' in update['message']['text']:
                    keyword = update['message']['text'].split(' ', 2)
                    number = '+' + keyword[1]
                    message = keyword[2]
                    client = SinchSMS(tokens.key_sinch, tokens.secret_sinch)
                    client.send_message(number, message)
                    requests.get(
                        url + 'sendMessage',
                        params=dict(chat_id=update['message']['chat']['id'],
                                    text="Enviando '%s' para %s" %
                                    (message, number)))
            except KeyError as e:
                print(e)
                continue
    sleep(3)
Esempio n. 5
0
from keras import backend as K
import tensorflow as tf



number = '+919717181471'
#model._make_predict_function()
que = collections.deque()
global model
model= load_model('voice_classification_model5000v3.h5')
global graph
graph = tf.get_default_graph()

# ring buffer will keep the last 2 seconds worth of audio
#ringBuffer = RingBuffer(2 * 22050)'
client = SinchSMS('d896f903-2332-4e10-87ae-3c2c187df453','YRrFNl6eqkaAKN+QCZBinQ==')
counter = defaultdict()
classes = ["saw", "vehicle", "noise"]
p = pyaudio.PyAudio()
def callback(in_data, frame_count, time_info, flag):
    audio_data = np.fromstring(in_data, dtype=np.float32)
    
    # we trained on audio with a sample rate of 22050 so we need to convert it
    audio_data = librosa.resample(audio_data, 44100, 22050)
    mfccs = np.mean(librosa.feature.mfcc(y=audio_data, sr=22050, n_mfcc=40).T,axis=0) 
    mfccs = np.array(mfccs)
    mfccs = mfccs.reshape((1, 40))
    time.sleep(1)
    with graph.as_default():
        index = np.argmax(model.predict(mfccs))
        #print(classes[index])
Esempio n. 6
0
#!/usr/bin/python

import time
from sinchsms import SinchSMS
import RPi.GPIO as GPIO  # import RPi.GPIO module
from time import sleep
import time

number = 'my number'
message = 'You\'ve got mail!'
got_event = 0
expired = time.time()

client = SinchSMS(your_app_key, your_app_secret)

GPIO.setmode(GPIO.BCM)  # choose BCM or BOARD
GPIO.setup(23, GPIO.IN, pull_up_down=GPIO.PUD_UP)  # set a port/pin as an input


def send_sms():
    print("Sending '%s' to %s" % (message, number))
    response = client.send_message(number, message)
    message_id = response['messageId']

    response = client.check_status(message_id)
    while response['status'] != 'Successful':
        print(response['status'])
        time.sleep(1)
        response = client.check_status(message_id)