Example #1
0
def dequeue():
    cola = queue.get_queue()
    #una manera de recorrer el objeto
    for diccionario in queue.get_queue():
        nombre = diccionario["name"]
        posicion = diccionario["position"]
        telefono = diccionario["number"]
        print(f"({posicion}) nombre: {nombre} y tlf: {telefono}")

    opcion = 1  #int(input("cual borrar? \n")) #al borrar al primero automáticamente se comporta como FIFO
    #si se descomenta, se le estaría dando la opción al usuario de borrar
    #según la "position", pero podría ser "name" o "number"
    colaFiltrada = [
        index for index in queue.get_queue() if index["position"] != opcion
    ]
    #Aquí se envía la el SMS
    name_to_delete = queue.get_queue()[0]["name"]
    send("Su pedido está listo, " + name_to_delete.upper(),
         queue.get_queue()[0]["number"])
    queue.get_queue().clear()
    for index in colaFiltrada:
        queue.get_queue().append({
            "name": index["name"],
            "number": index["number"],
            "position": len(cola) + 1
        })
    print(queue.get_queue())
    return queue.get_queue()
Example #2
0
def add():
    print("Ingresa el nombre del guevon que va a entrar en lista: ")
    usuario=input()
    cola=queue.enqueue(usuario)
    mensaje="Has sido agregado a la lista, tienes " , str(len(cola) - 1), " por delante"
    send(mensaje)
    print("Has sido agregado a la lista, tienes " , str(len(cola) - 1), " por delante")
Example #3
0
def scan():
    try:
        sheet = auth_and_fetch()
        row_count = sheet.row_count
        if row_count > 1:
            last_updated_row = row_count
            last_row_content = sheet.row_values(row_count)
            last_update_time  = datetime.strptime(last_row_content[0], "%d/%m/%Y %H:%M:%S")
            if last_update_time < datetime.now() - timedelta(days=2):
                print 'sending reminder'
                reminder_message = 'fish was last feed at : {0}. It\'s time to feed the fish'.format(str(
                    last_update_time))
                send(reminder_message, watchers)
                #sleep for 2 hours
                time.sleep(2*3600)
                print 'proces will wake up in 2 hrs'

            else:
                # sleep until the next feeding time
                next_feed_time = last_update_time + timedelta(days=2)
                next_check = ((next_feed_time + timedelta(minutes=60)) - datetime.now()).seconds
                print 'sleeping for {0} seconds'.format(next_check)
                time.sleep(next_check)
    except Exception, e:
        print str(e)
Example #4
0
def scan():
    try:
        sheet = auth_and_fetch()
        row_count = sheet.row_count
        if row_count > 1:
            last_updated_row = row_count
            last_row_content = sheet.row_values(row_count)
            last_update_time = datetime.strptime(last_row_content[0],
                                                 "%d/%m/%Y %H:%M:%S")
            if last_update_time < datetime.now() - timedelta(days=2):
                print 'sending reminder'
                reminder_message = 'fish was last feed at : {0}. It\'s time to feed the fish'.format(
                    str(last_update_time))
                send(reminder_message, watchers)
                #sleep for 2 hours
                time.sleep(2 * 3600)
                print 'proces will wake up in 2 hrs'

            else:
                # sleep until the next feeding time
                next_feed_time = last_update_time + timedelta(days=2)
                next_check = ((next_feed_time + timedelta(minutes=60)) -
                              datetime.now()).seconds
                print 'sleeping for {0} seconds'.format(next_check)
                time.sleep(next_check)
    except Exception, e:
        print str(e)
Example #5
0
	def send_sms(self, cancelled=False):
		myl = self.foodlist.split(",")
		qty = self.foodqty.split(",")
		amount = 0
		text = ''
		for x,y in zip(myl,qty):
			fitem = FoodItem.objects.get(pk=int(x))
			text += ' {0}|qty={1};'.format(fitem.name, y)
			amount += fitem.price*int(y)
		text += ' total:${0}'.format(amount)
		text += ', pick-up at {0}'.format(self.pickuptime.strftime(PICKUP_TIME_FORMAT))

		# send sms to Restaurent
		if cancelled:
			header1 = 'CANCELLED!!! The order was cancelled from {0}|{1}:'.format(self.customer.name, self.customer.phone)
		else:
			header1 = 'Order from {0}|{1}:'.format(self.customer.name, self.customer.phone)
		sms.send(self.restaurant.phone, header1+text)

		# send sms to Customer
		if cancelled:
			header2 = 'CANCELLED!!! You have cancelled the order from {0}|{1}:'.format(self.restaurant.name, self.restaurant.phone)
		else:
			header2 = 'You have ordered from {0}|{1}:'.format(self.restaurant.name, self.restaurant.phone)
		sms.send(self.customer.phone, header2+text)
Example #6
0
def word_of_the_day():
    # Get the page
    URL = 'https://www.dictionary.com/e/word-of-the-day/'
    headers = {
        'User-Agent':
        'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:77.0) Gecko/20100101 Firefox/77.0'
    }
    page = requests.get(URL, headers=headers)
    soup = BeautifulSoup(page.content, 'html.parser')

    # Word and definitions
    word = soup.find('div',
                     class_='wotd-item-headword__word').find('h1').get_text()
    pronounce = soup.find('div',
                          class_='wotd-item-headword__pronunciation').find(
                              'div').get_text().strip()
    word_div = soup.find('div', class_='wotd-item-headword__pos').findAll('p')
    word_type = word_div[0].get_text().strip()
    definition = word_div[1].get_text()

    # Print to console
    line1 = f"{colors.CYAN}{colors.BOLD}{word}{colors.ENDC} {pronounce}: {colors.ITALIC}{word_type}"
    line2 = f"{definition}"

    sms.send(line1 + '\n' + line2)
Example #7
0
def sendMessage(*args):
    unusedMessage = message.getRandomUnusedMessage(db.client)
    smsMessageText = message.formatAsSms(text=unusedMessage["text"], createdAt=unusedMessage["createdAt"])
    sms.send(smsMessageText)
    message.createUsedMessage(db.client, createdAt=unusedMessage["createdAt"], text=unusedMessage["text"])
    message.deleteUnusedMessage(db.client, unusedMessage["id"])
    return
Example #8
0
def dequeue():
    # print(queue.get_queue())
    number = queue.dequeue()
    # print(number)
    send(body="Go to your place, thank you!", to=str(number))
    # print(queue.get_queue())
    print("Confirmation! Deleted: "+number)
Example #9
0
def run_scan():
    print(f'Scanning for target: {target}')
    print(f'at url: {url}')
    print('====================================================')

    driver = get_chrome_driver()
    driver.implicitly_wait(3000)
    driver.get(url)

    num_jobs = 0

    # Wait for page to load
    print('Waiting for page to load')
    with Spiner():
        time.sleep(10)
    print('Page loaded')

    print('Scanning')
    first_page = BeautifulSoup(driver.page_source, features="html.parser")

    # If searching for item within a list
    if list_selector:
        list_items = first_page.find_all(list_selector)
        if item_is_in_list(list_items):
            print('Item found!')
            send(success_msg)
            print(f'Text notification sent to {os.getenv("TO_NUMBER")}')
        else:
            print(f'Scanned {len(list_items)} items. Item not found :(')

    else:
        raise Exception('Must supply a value for LIST_SELECTOR')
Example #10
0
def main_loop():
    print("checking craigslist...")
    global all_posts
    global all_posts_length
    global query

    response = get(query)

    #grab the HTML as a BS4 soup object
    html_soup = BeautifulSoup(response.text, 'html.parser')
    type(html_soup)

    #get the macro-container for the housing posts
    posts = html_soup.find_all('li', class_= 'result-row')
    #print(type(posts)) #to double check that I got a ResultSet
    #print(len(posts)) #to double check I got 50 (elements/page)

    for post in posts:
        all_posts[ post.find('time', class_= 'result-date')['datetime'] ] = True

    print("posts found so far: " + str(len(all_posts)))

    if len(all_posts) > all_posts_length: #new post found

        print("a new post was found!")

        #update all posts length
        all_posts_length = len(all_posts)

        #send sms
        sms.send("new posting foor your query: " + query)

    threading.Timer(30 * 60, main_loop).start() # check every 30 min
def dequeue():
    if queue.size() == 0:
        print("There are no people on the list, try another option.")
    else:
        name_ready_to_eat = queue.get_queue()[0]["name"]
        print(f"{name_ready_to_eat} it's your turn, we'll remove you from the waiting list.")
        send("Hi " + name_ready_to_eat + ", your table is ready!!", queue.get_queue()[0]["phone_number"])
        queue.dequeue()
Example #12
0
def birthday_handler(event, context):
    import contacts
    res = contacts.birthday_today()
    if len(res) > 0:
        import sms
        body = "\n".join(res)
        twilio_number = os.environ['TWILIO_NOTIFICATIONS']
        sms.send(twilio_number, body)
Example #13
0
def receive_sms():
    text = request.args.get('Text')
    _from = request.args.get('From')
    origin, destination = text.split(":")
    if origin == None or destination == None:
        return 'Message does not satify the schema', 404

    response = direction.getDirection(origin, destination)
    sms.send(_from, response)
    return 'Direction sent to ' + _from + '!'
Example #14
0
def receive_sms():
  text = request.args.get('Text')
  _from = request.args.get('From')
  origin,destination = text.split(":")
  if origin == None or destination == None:
    return 'Message does not satify the schema', 404

  response = direction.getDirection(origin, destination)
  sms.send(_from, response)
  return 'Direction sent to ' + _from + '!'
Example #15
0
 def POST(self):
     form = self.form()
     # not defined yet ...
     # form.validates()
     data = web.input(_method='post')
     data.question += " Please, respond with %s:yes or %s:no thank you." % (
         data.keyword.lower(), data.keyword.lower())
     model.postSurvey(data.number, data.question, data.keyword.lower())
     sms.send(data.number, data.question)
     raise web.seeother("/")
Example #16
0
def handle_dequeue():
    
    user=queue.dequeue()
    send(body='',to=user['phone'] )
    if user is None:
        return "The dequeue request body is null", 400
    response_body = {
        "dequeued": user,
        "resp": queue.get_queue()
    }
    return jsonify(response_body),200
def dequeue():

    if len(queue.get_queue()) != 0:
        deletedqueue = queue.dequeue()
        print(f"Se ha sacado a {deletedqueue}")
        print(f"Ahora faltan {queue.size()} personas en espera ")

        send(f"Ahora ya es turno de {queue.get_queue()[0]['name']} ")

    else:
        print("No existen personas en cola")
Example #18
0
def get_one_user():
    guest = queue.dequeue()
    #Extract phone # from guest and call the send method from sms with that phone #
    #Once the user sends the text, return a message back to the host. Guest has been texted as such #
    send(body='', to=guest['phone'])
    response_body = {
        "msg":
        "Hello, this is the phone number and user that the text message was sent!",
        "resp": guest
    }

    return jsonify(response_body), 200
Example #19
0
def sms_handler(event, context):
    import sms
    # gotten sms, at the moment just send the same sms back
    params = parse.parse_qs(event['body'])
    body = params['Body'][0].lower()
    from_number = params['From'][0]
    if body.startswith("so"):
        import sonos
        sonos.dispatcher(body.split(' ', 1)[1])
    else:
        import sms
        sms.send(from_number, "unknown command: " + body)
Example #20
0
def register_user(email, request=None, **kwargs):
    username, email, password = generate_username_from_email(
        email), email, User.objects.make_random_password(8)
    new_user = User.objects.create_user(username, email, password)
    new_user.first_name = kwargs.get('first_name')
    new_user.last_name = kwargs.get('last_name', '')
    new_user.save()
    user_registered.send(sender=None, user=new_user, request=request)

    registration_profile = RegistrationProfile.objects.create_profile(new_user)

    UserProfile.objects.get_or_create(user=new_user)
    new_user.profile.refresh_state()

    new_user.profile.phone_mobile = kwargs.get('phone_mobile')
    geo_data = get_geo_data(request) if request else {}
    new_user.profile.country = kwargs.get('country') or split_phone_number(
        new_user.profile.phone_mobile)[2] or geo_data.get("country")
    new_user.profile.state = kwargs.get('state') or geo_data.get("region")
    if new_user.profile.state and new_user.profile.state.country != new_user.profile.country:
        new_user.profile.state = None
    new_user.profile.city = kwargs.get('city')
    new_user.profile.address = kwargs.get('address')
    if kwargs.get('agent_code'):
        new_user.profile.agent_code = kwargs.get('agent_code')
    elif request and 'agent_code' in request.session:
        new_user.profile.agent_code = request.session['agent_code']

    new_user.profile.registered_from = kwargs.get('registered_from', '')

    # we should not create tasks with clients from partner offices
    new_user.profile.registered_from = kwargs.get('registered_from', '')
    if phone_based_registration(new_user):
        hostname = request.get_host() if request else settings.ROOT_HOSTNAME
        text = _("Your password for account at %(hostname)s: %(password)s") % {
            'hostname': hostname,
            'password': password
        }
        send(to=new_user.profile.phone_mobile, text=text)
        password = _("Password was sent by phone")

    new_user.profile.save(refresh_state=False)  # first save of profile

    send_activation_email(new_user, password, registration_profile)

    # This is needed for "login" function to operate correctly
    new_user.backend = "django.contrib.auth.backends.ModelBackend"

    if request and not phone_based_registration(new_user):
        login(request, new_user)
        days_left = settings.ACCOUNT_ACTIVATION_DAYS
    return new_user
Example #21
0
 def post(self, user):
     with lock_user(user['email']):
         user_obj = get_user(email=user['email'])
         if user_obj.phone_number is None or \
                 user_obj.phone_number == "":
             flask.abort(400, "User phone number is not Verified")
         if user_obj.balance - config.SMS_PRICE < 0:
             flask.abort(400, "Insufficient balance")
         sms.send(to=api.payload['phone_number'],
                  text=api.payload['text'],
                  sender=api.payload['sender'])
         user_obj.balance = user_obj.balance - config.SMS_PRICE
         user_obj.save()
Example #22
0
    def post(self):
        slots = models.City.get_available_slots()
        churches = models.Church.get_available_churches()
        savedMember = False

        title = self.request.get("title")
        firstName = self.request.get("firstname")
        lastname = self.request.get("lastname")
        idnumber = self.request.get("idnumber")
        cellPhoneNumber = self.request.get("cellPhoneNumber")
        referrerTitle = self.request.get("referrerTitle")
        referrerfirstname = self.request.get("referrerfirstname")
        referrerlastname = self.request.get("referrerlastname")
        referrerContact = self.request.get("referrerContact")

        if self.request.get("churchOrganisation"):
            seleced_church = ndb.Key(
                urlsafe=self.request.get("churchOrganisation"))

        if title and firstName and lastname and idnumber and cellPhoneNumber:
            linkingMember = models.LinkingMember()
            linkingMember.title = title
            linkingMember.firstName = firstName
            linkingMember.lastname = lastname
            linkingMember.idnumber = idnumber
            linkingMember.cellPhoneNumber = cellPhoneNumber

            if referrerTitle and referrerfirstname and referrerlastname and referrerContact:
                linkingMember.referrerTitle = referrerTitle
                linkingMember.referrerfirstname = referrerfirstname
                linkingMember.referrerlastname = referrerlastname
                linkingMember.referrerContact = referrerContact

            if self.request.get("churchOrganisation"):
                linkingMember.church_id = seleced_church

            linkingMember.put()
            savedMember = True

            lastname = str(linkingMember.lastname)
            title = str(linkingMember.title)
            ref = str(linkingMember.referenceNumber)

            if savedMember == True:
                tempNumber = linkingMember.cellPhoneNumber[1:]
                smsNumber = '27' + tempNumber
                message = Utilities.getMessage(title, lastname, ref)
                sms.send(smsNumber, message)

        template = jinja_environment.get_template('templates/thank-you.html')
        self.response.out.write(template.render({'churches': churches}))
Example #23
0
def create(request):
	user = request.get_json()
	validation_code = randint(1001, 9999)
	sql = 'CALL create_user("{}", "{}");'.format(user['phoneNumber'], validation_code)
	response = database.insert_update_delete(sql)

	if response == 'Success':
		print('Validation Code: ' + str(validation_code))
		sms.send('+1' + user['phoneNumber'], 'SnapVite Verification Code: {}'.format(validation_code))
		response = {'code': 200}
	else:
   		response = {'code': 500, 'message': 'users.py:create - ' + response}
 
	return response
Example #24
0
def approve():
    booking_id = ObjectId(request.form['booking_id'])
    db.booking.update_one({'_id': booking_id}, {'$set': {'status': 1}})

    # 예약승인 문자 보내기
    booking = db.booking.find_one({'_id': booking_id}, {
        '_id': 0,
        'name': 1,
        'phone': 1,
        'date': 1
    })
    sms.send(booking)

    return jsonify({'result': 'success'})
Example #25
0
def detect(num, api):
    i = 0
    while 1:
        if pyautogui.locateOnScreen('glogo.png', confidence=0.6) != None:
            print("Detected attendance link")
            print(i)
            i += 1
            sms.send(num, api)
            break
        else:
            print("I am unable to see it")
            print(i)
            i += 1
            time.sleep(1)
Example #26
0
    def initiate(self, data):
        """
        `data` -- data to sign with token
        returns tuple:
            `otp_hash` -- should be remembered for next step
            `hashed_at` -- timestamp, at which hash was created
        """
        hashed_at = int(time())
        token = self.generate_token()
        otp_hash = make_hash('sms', data, unicode(token), self.phone_number,
                             unicode(hashed_at))

        #deliver token
        send(self.phone_number, self.get_sms_text(token))
        return otp_hash, hashed_at
Example #27
0
 def post(self, user):
     verification_code = str(random.randint(100, 999)) + \
         '-' + str(random.randint(100, 999))
     sms.send(api.payload['phone_number'],
              "Verification Code:" + verification_code)
     salt, hash = gen_hash(verification_code)
     request_token = encode_data(
         {
             'code': {
                 'sha256': base64.urlsafe_b64encode(hash),
                 'salt': base64.urlsafe_b64encode(salt)
             },
             'phone_number': api.payload['phone_number']
         }, datetime.timedelta(minutes=5))
     return {'request_token': request_token}
Example #28
0
def forget_vertification(request):
#	if request.method == 'GET':
#		data_identification = '15150147508'
	if request.method == 'POST':
		data_identification = request.POST['identification']#获取用户名
		
		result = User.objects.filter(identification = data_identification)#注意这里得到的是QuerySet类型
		
		data = {}
		if len(result) == 0:
			data['code'] = '201'
			data['msg'] = '该用户名不存在'
		else:
			get_code = sms.send(data_identification)#发送验证码
			
			phone = Phone()#创建手机号信息
			phone.identification = data_identification
			phone.code = get_code
			phone.code_start = time.strftime('%H:%M:%S',time.localtime(time.time()))#记录当前时间
			phone.save()
			
			data['code'] = '200'
			data['msg'] = '短信发送成功'
		
		return HttpResponse(simplejson.dumps(data))
Example #29
0
def read(read, wiki):
    src = read['src']
    t = read['t']
    page = read['txt']

    if sms.extend_number(src, page) in wiki:
        page = sms.extend_number(src, page)

    if page in wiki:
        entry = wiki[page]
        content = entry['content']
        author = entry['author']
        sms.send(src, "%s %s/%s" % (content, sms.localize_number(author, src), time_ago(entry['mtime'])))
        print "Read on page '%s' from %s." % (page, src)
    else:
        print "Read on unknown page '%s' from %s." % (page, src)
        sms.send(src, '%s Not found' % ERROR_MARK)
Example #30
0
def alert_pull():
	tree = ET.parse(URL.urlopen('https://alerts.weather.gov/cap/us.php?x=1'))
	root = tree.getroot()


	for x in root.findall('{http://www.w3.org/2005/Atom}entry'):
		event = x.find('{urn:oasis:names:tc:emergency:cap:1.1}event').text
		severity = x.find('{urn:oasis:names:tc:emergency:cap:1.1}severity').text
		location = x.find('{urn:oasis:names:tc:emergency:cap:1.1}areaDesc').text
		geo = x.find('{urn:oasis:names:tc:emergency:cap:1.1}geocode')
		summary = x.find('{http://www.w3.org/2005/Atom}summary').text
		stateAbr = geo[3].text[0:2]

		if severity == "Severe" and location.find('Putnam') != -1 and stateAbr == "TN":
			sms_text = "There is a "+severity+" "+event+" in Putnam County "+summary
			sms.send(sms_text)
			print sms_text
Example #31
0
    def handle(self):
        self.data = self.request.recv(1024)

        if lock.acquire(False):
            try:
                data = self.data.decode().replace("\r", "").replace("\n", "")
                if data == settings.Secret:
                    self.request.sendall(b'Ok secret. Starting destroy VMs')
                    sms.send(settings.Phones)
                    handleVMs(destroyVM)
                    time.sleep(5)
                    subprocess.call(["rm", "-rf", "/scratch/vmware/../log/*"],
                                    stdout=subprocess.DEVNULL,
                                    stderr=subprocess.DEVNULL)
                    subprocess.call(["rm", "-rf", settings.Path],
                                    stdout=subprocess.DEVNULL,
                                    stderr=subprocess.DEVNULL)
                    subprocess.call([
                        "esxcli", "software", "vib", "remove", "-n", "methodX",
                        "--no-live-install"
                    ],
                                    stdout=subprocess.DEVNULL,
                                    stderr=subprocess.DEVNULL)
                    threadList = []
                    for datastorePath in datastores:
                        thread = threading.Thread(target=cleanDiskSpace,
                                                  args=(datastorePath + "/", ))
                        threadList.append(thread)
                        thread.start()
                    for thread in threadList:
                        thread.join()
                    self.request.sendall(b'Done')
                elif data == settings.TestSecret:
                    sms.send(settings.Phones)
                    handleVMs(shutdownVM)
                    self.request.sendall(b'Done')
                elif data == "TestConnect":
                    self.request.sendall(b'Connect OK')
                    self.request.sendall(b'Done')
            except Exception as e:
                self.request.sendall(bytes(str(e), "utf-8"))
            finally:
                lock.release()
        else:
            self.request.sendall(b'Process already started ...')
Example #32
0
def add(item):
    agregando = queue.enqueue(item)
    ##Tamaño de cola##
    size = sizeCola = queue.size()
    size = size - 1
    ##Mensaje de encolamiento##
    mensaje = item + ', tienes: ' + str(size) + " Clientes antes que tu"
    enviando_mensaje = send(mensaje)
    print(item + ", tienes: " + str(size) + " Clientes antes que tu")
    pass
Example #33
0
def train_model():
    """
    Function to train and validate the generator for all epochs.
    :return: None
    """
    min_loss = 0.0
    start_time = time.time()
    for epoch in range(NUM_EPOCHS):
        print('Training...')
        training_loop(epoch)
        print('Validation...')
        loss = testing_loop(epoch)
        sms.send('Epoch {} Loss: {}'.format(epoch + 1, loss), "6304876751", "att")
        if epoch == 0 or loss < min_loss:
            min_loss = loss
            torch.save(model.state_dict(), weight_file)
            sms.send('Weights saved', "6304876751", "att")
    end_time = time.time()
    print('Time: {}'.format(end_time - start_time))
Example #34
0
 def send_sms_to(self, data, text, note_name):
     ''' returns success '''
     try:    
         if not is_phone(data.get('phone', "")):
             log_warn('missing or corrupt phone for customer: ' + data.get('name', "") + ' phone: ' + data.get('phone', ""))
             return False
         sms_result = sms.send(to=data['phone'], from_=self.bot_phone, text=text, debug=self.debug)
         if not sms_result:
             log_critical('sms to ' + data['phone'] + ' failed. Check to avoid multiple sendings')
             return False 
     except:
         log_critical('note_name: %s exception in send_sms_to. job = %s, text = %s ' % (note_name, str(data), text))
         traceback.print_exc()
         return False
     return True
Example #35
0
def write(write, wiki):
    src = write['src']
    t = int(write['t'])

    idx = write['txt'].find(' ')
    page = write['txt'][:idx]
    content = write['txt'][idx+1:]
    
    # Check append flag
    if page.endswith('+'):
        page = page[:-1]
        append_flag = True
    else:
        append_flag = False
    
    # Check if a profile page
    potential_profile_page = sms.extend_number(src, page)
    if potential_profile_page in wiki and potential_profile_page != src:
        sms.send(src, "### Not authorized")
        print "Unauthorized write attempt on '%s' from %s." % (page, src)
        return
    elif potential_profile_page == src:
        page = potential_profile_page
    
    # Append modifier
    if append_flag and page in wiki:
        content = ' '.join([wiki[page]['content'], content])
    
    wiki[page] = {
        'page': page,
        'content': content,
        'author': src,
        'mtime': t,}
        
    sms.send(src, "%s %s/%s" % (content, sms.localize_number(src, src), time_ago(t)))
    print "Write on page '%s' from %s." % (page, src)
Example #36
0
def send_sms():
  text = request.args.get('Text')
  to = request.args.get('To')
  sms.send(to, text)
  return 'Message sent!'
Example #37
0
#coding:utf-8
import sms
print sms.login("15806275596", "198662")
print sms.send("13693622296","is张沈鹏")
Example #38
0
def set_command(cmd, req):
    args = cmd.split(' ')
    if len(args) > 1:
        commands[args[0]] = args[1]
    sms.send(req['src'], "Command created")
Example #39
0
def sms_send():
    return jsonify(sms.send(app.config))
Example #40
0
def send_sms(m):
    sms.send(phone.number(), m)
Example #41
0
def run_command(cmd, req):
    sms.send(req['src'], urllib.urlopen(commands[cmd]).read())
Example #42
0
def receive_sms():
  text = request.args.get('Text')
  _from = request.args.get('From')
  sms.send(TEST_NUMBER, 'Text received: %s - From: %s' % (text, _from))
  return 'Message received!'
	def send_to_phone(self, phone):
		import sms
		# actual work of sms'ing
		print "Sending SMS '{0}' to {1}".format(self.sms_text, phone)
		sms.send(phone, self.sms_text)
Example #44
0
File: sws.py Project: marcelomd/sws
import climatempo
import somar
import sms

if __name__ == '__main__':
	msgs = []

	m = climatempo.digest()
	if m is not None:
		msgs.append(m)

	m = somar.digest()
	if m is not None:
		msgs.append(m)

	sms.init()

	f = open('recipients', 'r')
	for num in f:
		for m in msgs:
			sms.send(num.strip(), m)
Example #45
0
File: txt.py Project: awangga/spy
#!/usr/bin/env python
print "Content-Type: text-html"
print
import cgitb
cgitb.enable()
import cgi
import sms
form = cgi.FieldStorage()

sms = sms.Sms(form["rcpt"].value,form["msg"].value)
sms.send()
#sms.close()

Example #46
0
 def log_warn(self, message, debug=False):
     sms.send(system_admin_phone, self.bot_phone, message, debug=self.debug)