示例#1
0
def authcode(alexaId):

	code = request.args.get('code')
	userId = myApp.getUserIdFromAlexaId(alexaId)

	if st.smartThingsToken(alexaId, userId,code):

		print st.stData.getUser(userId).getClientInfo().token

		myApp.genNewAlexaId(userId,100)

	return redirect("/alexa")
示例#2
0
def authcode(alexaId):

    code = request.args.get('code')
    userId = myApp.getUserIdFromAlexaId(alexaId)

    if st.smartThingsToken(alexaId, userId, code):

        print st.stData.getUser(userId).getClientInfo().token

        myApp.genNewAlexaId(userId, 100)

    return redirect("/alexa")
示例#3
0
def samples():
	if request.method == 'GET':
		return echopy_doc.samples_page.format(settings.full_root_url)

	if request.method == 'POST':
		try:
			alexaId=request.form['AlexaID']
			userId = myApp.getUserIdFromAlexaId(alexaId)
			samples = st.getSamples(userId)
			myApp.genNewAlexaId(userId,100)
			return echopy_doc.samples_results.replace('RESULTS',samples.replace('\n','
')).format(settings.full_root_url)
		except:
			return echopy_doc.samples_results.replace('RESULTS',"AN ERROR HAS ACCRUED").format(settings.full_root_url)
示例#4
0
def authcode(alexaId):

	code = request.args.get('code')
	userId = myApp.getUserIdFromAlexaId(alexaId)

	if st.smartThingsToken(alexaId, userId,code):

		print "authed..."
		#print st.stData.getUser(userId).getClientInfo().token

		myApp.genNewAlexaId(userId,100)
		sendWelcomeEmail(userId)

	return redirect(settings.url_root)
示例#5
0
文件: echopy.py 项目: cfortan/Nest
def authcode(alexaId):

    code = request.args.get('code')
    userId = myApp.getUserIdFromAlexaId(alexaId)

    if st.smartThingsToken(alexaId, userId, code):

        print "authed..."
        #print st.stData.getUser(userId).getClientInfo().token

        myApp.genNewAlexaId(userId, 100)
        sendWelcomeEmail(userId)

    return redirect(settings.url_root)
示例#6
0
def samples():
    if request.method == 'GET':
        return echopy_doc.samples_page

    if request.method == 'POST':
        try:
            alexaId = request.form['AlexaID']
            userId = myApp.getUserIdFromAlexaId(alexaId)
            samples = st.getSamples(userId)
            myApp.genNewAlexaId(userId, 100)
            return echopy_doc.samples_results.replace(
                'RESULTS', samples.replace('\n', '
'))
        except:
            return echopy_doc.samples_results.replace('RESULTS',
                                                      "AN ERROR HAS ACCRUED")