def generatePhoneVerification(): with transact: session.user.update( phone_verification_code=random.randrange(1, 1000000), phone_verification_tries=0 ) sms(session.user.phone_number, 'Quest Companions verification code: %06i' % session.user.phone_verification_code)
def App_alarm(environ, start_response): try: _, door = environ['PATH_INFO'].split('/') request_length = int(environ.get('CONTENT_LENGTH', 0)) body = environ['wsgi.input'].read(request_length).decode('UTF-8') request_body = json.loads(body) except ValueError as e: return bad_req(start_response) try: msg = request_body['message'] except KeyError: return bad_req(start_response) s = db.create_session(config.db) r = db.Alarm(type=msg, door_name=door) s.add(r) try: s.commit() except: return bad_req(start_response) m = 'ALARM: ' + str(r) print(m) for recv in config.sms_receivers: sms(config.sms_device, recv, m) start_response("200 OK", []) return ([])
def App_alarm(environ,start_response): try: _,door=environ['PATH_INFO'].split('/') request_length=int(environ.get('CONTENT_LENGTH',0)) body=environ['wsgi.input'].read(request_length).decode('UTF-8') request_body = json.loads(body) except ValueError as e: return bad_req(start_response) try: msg=request_body['message'] except KeyError: return bad_req(start_response) s=db.create_session(config.db) r=db.Alarm(type=msg,door_name=door) s.add(r) try: s.commit() except: return bad_req(start_response) m='ALARM: '+str(r) print(m) for recv in config.sms_receivers: sms(config.sms_device,recv,m) start_response("200 OK",[]) return([])
def myISR(self, ev=None): flag = 0 fire = "Active Fire" gas = "No" life = "No" temp = "No" self.flag = GPIO.input(self.FlamePin) print(GPIO.input(self.FlamePin)) self.sensorStatus = "fire" + str(GPIO.input(self.FlamePin)) if self.sensorStatus == "fire1": self.setstatus() print("Flame is detected !") led.led().ledOff(33) led.led().ledOn(31) buzzer.buzzer().controllRunOn(7) print(str(datetime.datetime.now())) print("\nReading TEMPRATURE of affected area") temprature() time.sleep(2) print("\nDetecting Life in affected area") if motion(22, 40, 38).flag == 1: life = "Presence of life in the affected area" time.sleep(2) time.sleep(2) flag = flag + 1 cam.cam("fire") if flag != 0: email().emailSend("fire.png", "/home/pi/project/fire.png", temp, life, fire) print("Mail Sended") sms.sms("Number to send") flag = 0 print("Detecting LPG lekage in area") gasT.gas(38).grun() buzzer.buzzer().controllRunOff(7)
def generatePhoneVerification(): with transact: session.user.update(phone_verification_code=random.randrange( 1, 1000000), phone_verification_tries=0) sms( session.user.phone_number, 'Quest Companions verification code: %06i' % session.user.phone_verification_code)
def get_resend_code(): if session.user.phone_verified: redirect(get_index.url(session.user.id)) new = False if not session.user.phone_verification_code: generatePhoneVerification() new=True sms(session.user.phone_number, 'Quest Companions verification code: %06i' % session.user.phone_verification_code) return dict(new=new)
def get_resend_code(): if session.user.phone_verified: redirect(get_index.url(session.user.id)) new = False if not session.user.phone_verification_code: generatePhoneVerification() new = True sms( session.user.phone_number, 'Quest Companions verification code: %06i' % session.user.phone_verification_code) return dict(new=new)
def mainmenu(): print("\n") menu=["Please select a service","1.Top up","2.Bundles","3.Sms bundles","4.bonga","5. Okoa","6.Check balances","Press any key to exit"] for item in menu: print (item) choice=input(":") if choice=="1":print("Please dial *141*SractchcardPin#") elif choice=="2":bundles() elif choice=="3":sms() elif choice=="4":bonga() elif choice=="5":okoa() elif choice=="6":balances_check() else:return
def send_sms(): # write logic to send sms to students whose return-date is near-by # one-day before return-date c = open('D:\\issue_book.txt', 'r') is_bk_ls = c.readlines() c.close() for one_line in is_bk_ls: ls = one_line.split(",") if ls[3] == "NOT\n": s_mob = get_mob_num(ls[0]) sms.sms(s_mob)
def bot(): timer = time.time() sold_out = True print("Bot is starting") print("Loading item page") still_running_check = 0 while ( sold_out == True ): # while item is sold out reload the page and print sold out to the console driver.get(item_url) # time.sleep(1) sold_out = check_exists_by_xpath( "/html/body/div[3]/main/div[2]/div[3]/div[2]/div/div/div[6]/div[1]/div/div/div/button" ) still_running_check += 1 sms_reply() # if still_running_check%100==0: # sms('Bot is still running and is on attempt '+str(still_running_check)+'\n '+str(round((time.time()-timer)/60,2))+' minute(s) have passed') if sold_out == False: break else: print("Sold out") cart_button = driver.find_element_by_class_name( "fulfillment-add-to-cart-button" ) # once sold out is no longer true add to cart button is clicked cart_button.click() time.sleep(1) driver.get("https://www.bestbuy.com/checkout/r/fast-track" ) # navigates to checkout page time.sleep(1) code = driver.find_element_by_xpath( '//*[@id="credit-card-cvv"]') # csv input location code.send_keys(security_code) # inputs previously given csv code time.sleep(2) # confirm_button= driver.find_element_by_class_name("button--place-order-fast-track") # confirm_button.click() print( 'Order submission screenshot saved as "OrderSubmission.png" in repository location' ) # order completion code driver.get_screenshot_as_file("OrderSubmission.png") sms("Bot Program executed succesfully for " + title.text) end = input( title.text + " program executed succesfuly hit enter to exit browser or type retry to start bot again:" ) # if program ran all the way through will print program ran succesfully if end == "retry": pass
def port_try(host, port): shijian = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time())) sk = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sk.settimeout(1) try: sk.connect((host, port)) t = host + "服务器 " + str(port) + " 连接正常 " + str(shijian) #sms(t) print t except Exception: w = host + " 服务器 " + str(port) + " 无法连接 " + str(shijian) print w sms(w) sk.close()
def run(self): sms_ = sms(rx=board.GP5, tx=board.GP4) sensors_ = sensors(i2c) gps_ = gps(i2c, 1000) sms_.send_msg("gps+sensors ok") sleep_ms(50) sms_.report() print("Done") return calibration(sms_, sensors_, gps_)
def nearby(): # Use your own API key for making api request calls API_KEY = 'your API Key' # Initialising the GooglePlaces constructor google_places = GooglePlaces(API_KEY) # fix location # latitude = 27.568891 # longitude = 76.640637 location = gps.location() latitude = location[0] longitude = location[1] # call the function nearby search with the parameters as longitude, latitude, radius # and type of place which needs to be searched of nearby_hospital = google_places.nearby_search( lat_lng ={'lat': latitude, 'lng': longitude}, types =[types.TYPE_HOSPITAL]) nearby_police = google_places.nearby_search( lat_lng ={'lat': latitude, 'lng': longitude}, types =[types.TYPE_POLICE]) for i, j in zip(nearby_hospital.places, nearby_police.places): print (i.name) print("Latitude =",i.geo_location['lat']) print("Longitude =",i.geo_location['lng']) i.get_details() print("Phone no. =", i.international_phone_number) con.append(i.international_phone_number) print() print (j.name) print("Latitude =",j.geo_location['lat']) print("Longitude =",j.geo_location['lng']) j.get_details() print("Phone no. =", j.international_phone_number) con.append(j.international_phone_number) print() break sms.sms(latitude,longitude)
def __init__(self): self.lib_version = '1.1.1' self.api_key = None self.api_private = None self.base_url = 'https://api.quiubas.com' self.version = '2.1' self.network = network(self) self.balance = balance(self) self.sms = sms(self)
def __init__( self ): self.lib_version = '1.0.0' self.api_key = None self.api_private = None self.base_url = 'https://rest.quiubas.com' self.version = '1.0' self.network = network( self ) self.balance = balance( self ) self.callback = callback( self ) self.keywords = keywords( self ) self.sms = sms( self )
def demo_sms(): sms_module=sms.sms() msgs = sms_module.get_msg_ids() print 'ids in box:' for box in msgs: print box for id in msgs[box]: print id print '___' msg_id=msgs['draft'] print 'content of first draft msg:' print sms_module.get_msg_content('draft', msg_id[0]) print 'time of first draft msg:' print sms_module.get_msg_time('draft', msg_id[0]) print 'address of first draft msg:' print sms_module.get_msg_address('draft', msg_id[0])
) time.sleep(2) if cart_not_empty == True: input("WARNING CART IS NOT EMPTY.hit enter if you wish to proceed") else: print("Cart is empty") print("Setup is now complete") driver.get(item_url) time.sleep(1.5) title = driver.find_element_by_xpath( "/html/body/div[3]/main/div[2]/div[3]/div[1]/div[1]/div/div/div[1]/h1") print("Selected item is " + title.text) input("Hit enter when ready to start bot") sms("bot for " + title.text + " has started") def bot(): timer = time.time() sold_out = True print("Bot is starting") print("Loading item page") still_running_check = 0 while ( sold_out == True ): # while item is sold out reload the page and print sold out to the console driver.get(item_url) # time.sleep(1)
def sms(self, message): if not self.phone_verified: return False sms(self.phone_number, message) return True
sql=("select emailid from studentdetails where semester = 8") cursor.execute(sql) data=cursor.fetchall() for row in data: print(row[0]) sendmail (send,row[0],header) except Exception as e: print("Exception In send MAIL" +str(e)) try: sql=("select mobile from studentdetails where semester = 8") cursor.execute(sql) data=cursor.fetchall() q=w.sms() for row in data: q.send(row[0],send) n=q.msgSentToday() print("Sms Sent" +row[0]) except Exception: print("Exception In SMS") sem8rem = False if "BE SEM 7 - Remedial (NOV 2017)" in msg and sem7rem: send = "Result of BE SEM 7 - Remedial (NOV 2017) Exam Declared. Check Here--> http://bit.ly/GtuResult All The Best From : KePy" header = "Result Declared"
umd.read(genesis.headerAddress, genesis.headerSize, args.rd, "_header.bin") # display for item in sorted( genesis.formatHeader("_header.bin").items()): print(item) # cleanup try: os.remove("_header.bin") except OSError: pass del genesis # Master System Header if args.mode == "sms": sms = sms() # header from file or from UMD? if args.file != "console": extractHeader(sms.headerAddress, sms.headerSize, args.file, "_header.bin") else: umd = umd(cartType) umd.read(sms.headerAddress, sms.headerSize, args.rd, "_header.bin") for item in sorted(sms.formatHeader("_header.bin").items()): print(item) # cleanup try: os.remove("_header.bin") except OSError:
#downloads the website request_page = bs4.BeautifulSoup(request_url.text) elems = request_page.select('.pubg_button') if elems[0].getText() == "SIGN UP FOR EU - OPENING SOON!": print("Attempting...") time.sleep(20) #wait 20seconds continue #continue after 20seconds else: msg = 'Check the Tournament http://en.intelextrememasters.com/season-12/oakland/pubg/' from_email = 'from_email' to_email = 'to_email' #send sms to my number sms() #server settings to send your email. server = smtplib.SMTP('smtp.mail.yahoo.com', 587) server.starttls() server.login("login", "password") print("From: " + from_email) print("To: " + str(to_email)) print("Message: " + msg) server.sendmail(from_email, to_email, msg) server.quit break #stop the script
from sms import sms from email import email sms1 = sms(12315672636, 41625743573) sms1.set_message("informuję, że nasze czwartkowe spotkanie zostało odwołane.") sms1.send() email1 = email("*****@*****.**", "*****@*****.**", "Spotkanie") email1.set_message( "informuję, że nasze czwartkowe spotkanie zostało odwołane.") email1.send()
from twilio.twiml.messaging_response import MessagingResponse from twilio.rest import Client from sms.sms import * app = Flask(__name__) @app.route("/getAuctionByNumber") def getAuctionByNumber(): auctionNum = request.args.get('auctionNumber') auctionInfo = sp.auctionDict[int(auctionNum)] return auctionInfo.display() @app.route("/listAllAuctions", methods=['GET', 'POST']) def listAllAuctions(): destinationPhoneNumber = request.args.get('destinationPhoneNumber', None) allAuctions = '' for i in sp.auctionDict.values(): if destinationPhoneNumber is None: allAuctions += i.display() else: allAuctions = i.display() messageHandler.sendMessageNoHTTP(destinationPhoneNumber,allAuctions) return allAuctions if __name__ == "__main__": sp=Surplus() sp.processAuctions() sp.toCSV() messageHandler = sms() app.run(debug=True)
# print("RBF kernel: $" + str(predicted_price[0])) # print("Linear kernel: $" + str(predicted_price[1])) # print("Polynomial kernel: $" + str(predicted_price[2])) predicted_low = predict_low(dates, low, day) # print("\nThe stock low price for "+ date + "-" + month +"-" + year + ";") test_min = (predicted_low[0] + predicted_low[1] + predicted_low[2]) / 3 # print("RBF kernel: $" + str(predicted_low[0])) # print("Linear kernel: $" + str(predicted_low[1])) # print("Polynomial kernel: $" + str(predicted_low[2])) predicted_high = predict_high(dates, high, day) # print("\nThe stock high price for "+ date + "-" + month +"-" + year + ";") test_max = (predicted_high[0] + predicted_high[1] + predicted_high[2]) / 3 # print("RBF kernel: $" + str(predicted_high[0])) # print("Linear kernel: $" + str(predicted_high[1])) # print("Polynomial kernel: $" + str(predicted_high[2])) if test_min > float(lim[0]) and float(lim[1]) > test_max: print("\nUnder threshold limits... Everything is fine\n") else: sms.sms() print("\nOut of threshold... SMS sent!!!\n") print("Predicted Results:") print("High: " + str(test_max)) print("Low: " + str(test_min)) print( "\n=================================================================\n" )
def alertcenter(url,errcode): if ALERT_METHOD == "sms": sms(url,errcode) elif ALERT_METHOD == "email": email(url,errcode)
m = md5.new() #db = MySQLdb.connect(host='ops-db1001.ve.box.net', user='******', passwd='yYWozySc', db='nagios') #cursor = db.cursor(MySQLdb.cursors.DictCursor) args = {} args['contactpager'] = sys.argv[2] rawmessage = email.message_from_string(sys.stdin.read()) message = rawmessage.get_payload() print message # cursor.execute("SELECT * FROM nagios.sms_users WHERE phonenumber=%s", (args['contactpager'], )) # sms_user = cursor.fetchone() # if sms_user is None: # cursor.execute("INSERT INTO nagios.sms_users (name, phonenumber) VALUES('', %s)", (args['contactpager'], )) # db.commit() # sms_user = { 'truncate': 0, 'throttle': 0 } m.update(message) hash = m.hexdigest()[-6:] s = sms.sms() # if sms_user['throttle']: # cursor.execute("SELECT COUNT(*) AS foo FROM nagios.sms_messages WHERE phonenumber=%s AND sent_at > DATE_SUB(NOW(), INTERVAL 2 MINUTE)", (args['contactpager'], )) # row = cursor.fetchone() # if row['foo'] > THROTTLE_LIMIT: # sys.exit(0) #s.send(args['contactpager'], hash + ' - ' + message, truncate=sms_user['truncate']) s.send(args['contactpager'], hash + ' - ' + message, truncate=0)