Skip to content

Instantly share code, notes, and snippets.

@netmanchris
Created September 2, 2017 17:42
Embed
What would you like to do?
Alexa ServerTech SNMPPDU Skill
import logging
from pyservertech.auth import *
from pyservertech.core import *
from flask import Flask, render_template
from flask_ask import Ask, statement, question, session
app = Flask(__name__)
app.config['ASK_VERIFY_REQUESTS'] = False
ask = Ask(app, "/")
logging.getLogger("flask_ask").setLevel(logging.DEBUG)
@ask.launch
def new_game():
welcome_msg = render_template('welcome')
return question(welcome_msg)
@ask.intent("YesIntent")
def select_device():
numbers = []
select_dev_msg = render_template('select_dev')
session.attributes['numbers'] = numbers
return question(select_dev_msg)
@ask.intent("AnswerIntent", convert={'first': int})
def power_on_dev(first):
myauth = STAuth('10.101.0.31', 'public', 'private')
print (myauth)
power_on(myauth, first)
msg = render_template('poweron')
return statement(msg)
if __name__ == '__main__':
app.run(debug=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment