コード例 #1
0
ファイル: app.py プロジェクト: Fame-Game/famegame
def updatePage(game_name):
    if request.method == 'POST':
        username = request.cookies.get("username")
        usertype = bool(request.cookies.get("usertype"))
        game = {
            'game_name': game_name,
            'game_link': request.form.get('update_link'),
            'curr_version': request.form.get('update_version')
        }
        print(game)
        updateGameStatus, updateGame = db_query.updateGame(game)
        if updateGameStatus == 200:
            for mail in updateGame:
                sendMail(mail[0])
            flash("Game is updated successfully")
            return render_template("update.html",
                                   username=username,
                                   usertype=usertype)
        else:
            flash("Game is not updated")
            return render_template("update.html",
                                   username=username,
                                   usertype=usertype)
    else:
        username = request.cookies.get("username")
        usertype = bool(request.cookies.get("usertype"))
        gameName = game_name
        print(gameName)
        return render_template("update.html",
                               username=username,
                               usertype=usertype,
                               gameName=gameName)
コード例 #2
0
ファイル: app.py プロジェクト: famegame/famegame
def contactDetails():
	name = request.form.get("name")
	email = request.form.get("email")
	subject = request.form.get("subject")
	message = request.form.get("message")
	contactDetails = {"name":name, "email":email, "subject":subject, "message":message}
	print("contactdetails", contactDetails)
	sendMail('*****@*****.**', contactDetails)
	flash("Your query has been registered. We will contact you soon")
	return redirect("/contact.html")
コード例 #3
0
ファイル: models.py プロジェクト: PrincetonUSG/USG-srv-dev
	def sendConfirmation(self):
		if self.type == EMAIL:
			subject = "Your Subscription to %s" % str(self.theclass)
 			body = r"""
You've subscribed to %s via PrincetonPounce!  We'll send you an email if seats in the class open up.
 			""" % str(self.theclass)
  			return emails.sendMail(self.address, subject, body)
  			
  		elif self.type == TEXT:
			sender = TWILIO_NUMBER
			client = TwilioRestClient(TWILIO_ACCOUNT_ID, TWILIO_TOKEN)
			body = r"""
	You've subscribed to %s via PrincetonPounce!  We'll send you a text if seats in the class open up.
			""" % str(self.theclass)
			return client.sms.messages.create(to=self.address, from_=sender, body=body)  			
コード例 #4
0
ファイル: models.py プロジェクト: PrincetonUSG/USG-srv-dev
	def sendNotification(self):
		if self.type == EMAIL:
			subject = 'Open Spot in %s' % str(self.theclass)
			body = """A spot has opened up in %s. If the class fills up before you can make it to SCORE, you'll have to resubscribe for notifications here:\n http://pounce.tigerapps.org/reactivate/%s.""" % (str(self.theclass), str(self.pk))
  			return emails.sendMail(self.address, subject, body)

		elif self.type == TEXT:
			sender = TWILIO_NUMBER
			client = TwilioRestClient(TWILIO_ACCOUNT_ID, TWILIO_TOKEN)
			body = """
			A spot has opened up in %s! If you don't make it to SCORE in time, you MUST resubscribe!
			""" % (str(self.theclass))
			try:
				return client.sms.messages.create(to=self.address, from_=sender, body=body)
			except:
				pass
コード例 #5
0
	def sendConfirmation(self):
		if self.type == EMAIL:
			subject = "Your Subscription to %s" % str(self.theclass)
 			body = r"""
You've subscribed to %s via PrincetonPounce!  We'll send you an email if seats in the class open up.
 			""" % str(self.theclass)
  			return emails.sendMail(self.address, subject, body)
  			
  		elif self.type == TEXT:
			account = "ACb6ccec5f910e1789a22033c47223a8e6"
			token = "07e6c98d7ec04ca28abec4c57e556af3"
			sender = "6094608209"
			client = TwilioRestClient(account, token)
			body = r"""
	You've subscribed to %s via PrincetonPounce!  We'll send you a text if seats in the class open up.
			""" % str(self.theclass)
			return client.sms.messages.create(to=self.address, from_=sender, body=body)  			
コード例 #6
0
	def sendNotification(self):
		if self.type == EMAIL:
			subject = 'Open Spot in %s' % str(self.theclass)
			body = """A spot has opened up in %s. If the class fills up before you can make it to SCORE, you'll have to resubscribe for notifications here:\n http://pounce.tigerapps.org/reactivate/%s.""" % (str(self.theclass), str(self.pk))
  			return emails.sendMail(self.address, subject, body)

		elif self.type == TEXT:
			account = "ACb6ccec5f910e1789a22033c47223a8e6"
			token = "07e6c98d7ec04ca28abec4c57e556af3"
			sender = "6094608209"
			client = TwilioRestClient(account, token)
			body = """
			A spot has opened up in %s! If you don't make it to SCORE in time, you MUST resubscribe!
			""" % (str(self.theclass))
			try:
				return client.sms.messages.create(to=self.address, from_=sender, body=body)
			except:
				pass
コード例 #7
0
        elif 'time' in command:
            currentTime = datetime.datetime.now().strftime("%H:%M:%S")
            printAndSpeak(f"the time is {currentTime}")

        elif 'calculator' in command:
            os.startfile("C:\\Windows\\System32\\calc.exe")

        elif 'what can you do' in command or 'help' in command:
            printAndSpeak(
                "I can do small things that you give such as \n  "
                "1 Every application will be open  \n using command \"open\" and \" your apllication name\" like \"open google\" or  \"open youtube\" \n"
                "2.I can search your query on wikipedia and will be give best result \n using command \"wikipedia\" and \"then your query.\"  \n"
            )

        elif 'email' in command:
            sendMail()

        elif 'shutdown my computer' in command or 'shutdown my pc' in command or 'shutdown my laptop' in command or 'please shut down' in command:
            speak("do you want shutdown your computer system")
            confirm = takeCommand().lower()
            if 'yes' in confirm:
                printAndSpeak("The computer is shutting down.")
                os.system("C:/Windows/System32/shutdown.exe")
                break
            elif 'no' in confirm:
                printAndSpeak("Confirmation has been canceled")
                continue
            else:
                printAndSpeak("please confirm your task")

        elif 'sleep my computer' in command or 'sleep my pc' in command or 'sleep my laptop' in command or 'please sleep' in command: