示例#1
0
def register(request):
	context = RequestContext(request)
	if request.method == 'POST':
		password 	= request.POST['password']
		fname 		= request.POST['fname']
		lname		= request.POST['lname']
		phno		= request.POST['phno']
		bg			= request.POST['bg']
		age			= request.POST['age']
		user = User.objects.create_user(username=phno,
                                 		password=password)
		user.save()
		rnum=random.randint(1000,9999)
		p=donor(user=user,
				  fname=fname,
				  lname=lname,
				  phno=phno,
				  blood_type=bg,
				  otp=rnum,
				  age=age,)
				  #otpdate=datetime.datetime.now())
		p.save()
		message="OTP"
		message+=str(rnum)
		pn=int(phno)
		q=way2sms.sms(8891821262,"way2sms3131")
		q.send(pn,message)
		n=q.msgSentToday()
		q.logout()
		return render(request,'otp.html',{'phno':phno})
		#
		#return render(request,'PatientPortal/otp.html',{})
	return redirect(logina)
def access():
    if (username.get() == login1[0]) and (password.get() == login2[0]):
        root.destroy()
        power()
    else:
        rootm = Tk()
        rootm.focus()
        rootm.overrideredirect(1)
        w = 300  # width for the Tk root
        h = 100  # height for the Tk root

        # get screen width and height
        ws = rootm.winfo_screenwidth()  # width of the screen
        hs = rootm.winfo_screenheight()  # height of the screen

        # calculate x and y coordinates for the Tk root window
        x = (ws / 2) - (w / 2)
        y = (hs / 2) - (h / 2)

        # set the dimensions of the screen
        # and where it is placed
        rootm.geometry('%dx%d+%d+%d' % (w, h, x, y))
        rootm.attributes('-alpha', 0.6)
        rootm.configure(background='black')
        lbldate = Label(rootm,
                        text='Invalid Login',
                        foreground='white',
                        background='black',
                        font=('arial', 20, 'bold'))
        lbldate.pack(side=TOP)

        ################ This is the invisible close button. To close click at the bottom middle without login ###############
        ################ Remove this if u dont need ##########################################################################

        close = Button(rootm,
                       text="close",
                       command=lambda: rootm.destroy(),
                       border='5',
                       background='black',
                       foreground='white',
                       activebackground='black',
                       highlightcolor='black')
        close.focus()
        close.bind('<Return>', lambda _: rootm.destroy())
        close.pack(side=TOP)

        ############### Set your way2sms login Number and Password here

        q = way2sms.sms("99XXXXXXXX", "your_way2sms_password")

        ############### Your message here and phone number to send the message to ##############################

        q.send('99XXXXXXXX', 'Someone is trying to access')
        q.msgSentToday()
        q.logout()
        username.set("")
        password.set("")
        e1Username.focus()
        return
def action(pin):
    print('Sensor detected action!')
    q = way2sms.sms("7038792582", "Q2253R")
    q.send(7038792582, "SMOKE HAS BEEN DETECTED")
    GPIO.output(12, 1)

    GPIO.output(12, 0)
    return
示例#4
0
 def alert(self):
     try:
         message = way2sms.sms('8983050329', 'betheone')
         message.send(mobile_number, 'There is a storage box in the room')
         sent_count = message.msgSentToday()
         print 'Message Sent Count =', sent_count
         # 100 messages are free/day
         message.logout()
     except:
         print 'Message sending Failed!'
示例#5
0
def send_sms(receiver, message):
    '''
    reciver = str
    message = str
    :param receiver:
    :param message:
    :return:
    '''
    q = way2sms.sms(receiver, message)
    q.send(receiver.decode('utf-8'), message)
    q.logout()
    return True
示例#6
0
def sendSMS(to, message):
    import way2sms #this file contains main program
    
##    q=way2sms.sms("7055455188","D9SsA7DZa5FX") # creating object with  my login details for website. Don't change this
    from requests.exceptions import ConnectionError
    try:
        q=way2sms.sms("9557722520","kb115198122")
        return(q.send( str(to), str(message))) # sends sms. Both parameters must be string
    except ConnectionError:
        return 'connection error'
    except:
        return False

##    return(q.msgSentToday()) # msgSentToday returns how many msg are send today
    
    q.logout()
示例#7
0
# Third Party App Imports
from rest_framework.views import APIView
from rest_framework.response import Response

from clarifai.rest import ClarifaiApp
from clarifai.rest import Image as ClImage
from StringIO import *
import requests
import way2sms  # Import this module to send free text message

# Clarifai API Initialization
app = ClarifaiApp(api_key='aa53cdc859b84d4d95190962e8613c9a')
model = app.models.get('general-v1.3')

# Way2SMS settings
message = way2sms.sms('8983050329', 'betheone')  # way2sms credentials
mobile_number = '9011041156'
# Recipient's Mobile number to which the alert message will be sent


class PredictImageObject(APIView):
    # This will send the alert message to the number specified
    def alert(self):
        try:
            message = way2sms.sms('8983050329', 'betheone')
            message.send(mobile_number, 'There is a storage box in the room')
            sent_count = message.msgSentToday()
            print 'Message Sent Count =', sent_count
            # 100 messages are free/day
            message.logout()
        except:
示例#8
0
import way2sms
q = way2sms.sms('7042548961', "amanisawsm25")
q.send('7042548961', 'hello')
n = q.msgSentToday()
q.logout()
def test():

    for count in range(2, 270):
        upper_threshold = 100000
        lower_threshold = -100000
        bnf_spot = count_in_db = query_db(
            "SELECT BNF_" + str(count) + ",TIME_" + str(count) +
            " FROM CALL_OI_TRACK WHERE STRIKE_PRICE='26500.00'")
        call_oi_decrease = get_oi_mg_details(
            "SELECT STRIKE_PRICE, (CAST(REPLACE(VALUE_" + str(count) +
            ", ',', '') AS INT) - CAST(REPLACE(VALUE_" + str(count - 1) +
            ", ',', '') AS INT)) AS CHANGE FROM CALL_OI_TRACK ORDER BY CHANGE")
        call_oi_increase = get_oi_mg_details(
            "SELECT STRIKE_PRICE, (CAST(REPLACE(VALUE_" + str(count) +
            ", ',', '') AS INT) - CAST(REPLACE(VALUE_" + str(count - 1) +
            ", ',', '') AS INT)) AS CHANGE FROM CALL_OI_TRACK ORDER BY CHANGE DESC"
        )
        put_oi_decrease = get_oi_mg_details(
            "SELECT STRIKE_PRICE, (CAST(REPLACE(VALUE_" + str(count) +
            ", ',', '') AS INT) - CAST(REPLACE(VALUE_" + str(count - 1) +
            ", ',', '') AS INT)) AS CHANGE FROM PUT_OI_TRACK ORDER BY CHANGE")
        put_oi_increase = get_oi_mg_details(
            "SELECT STRIKE_PRICE, (CAST(REPLACE(VALUE_" + str(count) +
            ", ',', '') AS INT) - CAST(REPLACE(VALUE_" + str(count - 1) +
            ", ',', '') AS INT)) AS CHANGE FROM PUT_OI_TRACK ORDER BY CHANGE DESC"
        )

        a = False
        b = False
        c = False
        d = False

        bnf_s = 0
        time_ = ''
        for chg in bnf_spot:
            bnf_s = chg[0]
            time_ = chg[1]

        message = "@" + time_ + " Spot - " + str(bnf_s) + "\n"
        message += "Call\n"
        message += "Down\n"
        for i in range(0, 2):
            if int(call_oi_decrease[i]['change']) < lower_threshold:
                message += str(int(Decimal(
                    call_oi_decrease[i]['strikePrice']))) + " " + str(
                        call_oi_decrease[i]['change']) + "\n"
                a = True
        if not a:
            message += "None\n"
        message += "Up\n"
        for i in range(0, 2):
            if int(call_oi_increase[i]['change']) > upper_threshold:
                message += str(int(Decimal(
                    call_oi_increase[i]['strikePrice']))) + " " + str(
                        call_oi_increase[i]['change']) + "\n"
                b = True
        if not b:
            message += "None\n"
        message += "Put\n"
        message += "Down\n"
        for i in range(0, 2):
            if int(put_oi_decrease[i]['change']) < lower_threshold:
                message += str(int(Decimal(
                    put_oi_decrease[i]['strikePrice']))) + " " + str(
                        put_oi_decrease[i]['change']) + "\n"
                c = True
        if not c:
            message += "None\n"
        message += "Up\n"
        for i in range(0, 2):
            if int(put_oi_increase[i]['change']) > upper_threshold:
                message += str(int(Decimal(
                    put_oi_increase[i]['strikePrice']))) + " " + str(
                        put_oi_increase[i]['change']) + "\n"
                d = True
        if not d:
            message += "None\n"
        if a or b or c or d:
            print message
        if a or b or c or d:
            q = way2sms.sms(config.get('username'), config.get('password'))
            if not q.send(config.get('username'), message):
                print('Message not sent')
            print('Total messages sent today - ' + str(q.msgSentToday()))
            q.logout()
示例#10
0
#import twilio

#accountSid = 'AC04bfbed3f9e9a5f3e47c094798bf7828'
#authToken = '3c7b1fbf59283034479890c803e3ffe4'
#twilioClient = TwilioRestClient(accountSid, authToken)
#myTwilioNumber = 7875041144
#destCellPhone =8421348474
#myMessage = twilioClient.messages.create(body="whatever", from_=7875041144, to=8421348474)


import way2sms

q = way2sms.sms('7875041144','sumeru')
q.send('8421348474', 'hello')
n = q.msgSentToday()
q.logout()
示例#11
0
def send_msg():
    q = way2sms.sms(9*92420886, 'XXX')
    q.send('9892420886', 'Intruder Alert')
    q.logout()
    print("sms sent")
示例#12
0
def send_sms(receiver, message):
    q = way2sms.sms(username, password)
    q.send(unicode(receiver), message)
    n = q.msgSentToday()
    q.logout()
def login(username, password):
    q = way2sms.sms(username, password)
    return q
示例#14
0
def send_sms():
    import way2sms
    q=way2sms.sms('9969351313','gauravtalele123')
    q.send( '9082463267', 'hello Mam, Good Morning' )
    print(q.msgSentToday())
    q.logout()
port_number = input('Enter port number: ')
ser = serial.Serial('/dev/ttyACM' + str(port_number))
ser.flushInput()

additional_mobile_numbers = [x.strip() for x in str(input('Enter comma seperated mobile numbers: ')).split(',')]
print ('Registered numbers: ', additional_mobile_numbers)

while True:
	try:
		time.sleep(0.02)
		ser_bytes = ser.readline()
		decoded_bytes = int(ser_bytes[0:len(ser_bytes)-2].decode("utf-8"))
		print(decoded_bytes)
		if decoded_bytes == 1:
			worked = False
			for user, pw in zip(from_mobile_number,password):
				q = way2sms.sms(user, pw)
				for mob in additional_mobile_numbers:
					q.send(mob, message)
				if q.send(to_mobile_number,message): 
					worked = True
					print('Success')
				q.logout()
				if worked:
					break
	except:
		pass
		#print(traceback.format_exc())

示例#16
0
import way2sms

username = raw_input("Enter your username:"******"Enter your password:"******"Hey this is my text message!"

message.send(recipient_number, text_message)
print("Message Sent!")

sent_count = message.msgSentToday()
print("Message Sent count:", sent_count)

message.logout()  # logout
print('Successfully Logged out!')
message = "Help!"

additional_mobile_numbers = []

port_number = input('Enter port number: ')
ser = serial.Serial('/dev/ttyACM' + str(port_number))
ser.flushInput()

additional_mobile_numbers = [
    x.strip()
    for x in str(input('Enter comma seperated mobile numbers: ')).split(',')
]
print('Registered numbers: ', additional_mobile_numbers)

while True:
    try:
        time.sleep(0.02)
        ser_bytes = ser.readline()
        decoded_bytes = int(ser_bytes[0:len(ser_bytes) - 2].decode("utf-8"))
        print(decoded_bytes)
        if decoded_bytes == 1:
            q = way2sms.sms(from_mobile_number, password)

            print(q.send(to_mobile_number, message))
            for mob in additional_mobile_numbers:
                q.send(mob, message)
            q.logout()
    except:
        pass
        #print(traceback.format_exc())
示例#18
0
import requests
from config import *

r = requests.get("https://api.ipdata.co?api-key=" + GLapikey).json()
print(r)

import way2sms
username = "******"
password = "******"
q = way2sms.sms(username, password)
def send_message(id, phone_number, Message):
    details = login_ids[id].split("-")
    q = way2sms.sms(details[0], details[1])
    q.send(phone_number, Message)
    return q
示例#20
0
import way2sms

q = way2sms.sms(9892420886, 'motionsensor')
q.send('9892420886', 'Intruder Alert')
q.logout()
示例#21
0
import time
import RPi.GPIO as GPIO
import os
import way2sms

GPIO.setmode(GPIO.BOARD)
GPIO.setup(13, GPIO.IN)
GPIO.setup(11, GPIO.OUT)

while True:
    i = GPIO.input(13)
    if (i == 1):
        print "Motion"
        os.system("raspistill -o image.jpg")
        q = way2sms.sms("7038792582", "Q2253R")
        q.send(7038792582, "Intruder has been detected, please check mail")
        print "Message sent"
        os.system("python sendimg.py")
        print "Email sent"

        q.logout()

    else:
        GPIO.output(11, 0)
        print "no motion"
    time.sleep(0.5)
示例#22
0
#!/usr/local/bin/python3
import GoogleManager
import json
import way2sms

google_manager = GoogleManager.GoogleManager()
today_events = google_manager.build_today_events()
tomo_events = google_manager.build_tomo_events()
with open('./sms-config.json') as sms_config_file:
    sms_config = json.load(sms_config_file)
q = way2sms.sms(sms_config['username'], sms_config['password'])
with open('./contacts.txt') as contacts:
    for contact in contacts.readlines():
        q.send(contact, today_events)
        q.send(contact, tomo_events)
q.logout()