Skip to content

hwonyo/flask-clova

Repository files navigation

flask_clova

PyPI PyPI

SDK of CEK (Clova Extension Kit) for Python

All the structure and ideas were copied after seeing flask-ask

About flask_clova

Table of Contents

Install

# setup requires will automatically installed in version >= 0.0.4
# pip install PyYAML
# pip install Flask

pip install flask_clova

Basics

from flask import Flask
from flask_clova import Clova, statement, question, say

app = Flask(__name__)
# must set CLOVA_VERIFY_REQUESTS False
# while testing wihtout application_id
# app.config['CLOVA_VERIFY_REQUESTS'] = False

clova = Clova(app, '/user_defined')

@clova.launch
def launch():
    return question(say.Korean('시작했습니다'))

@clova.intent('HelloIntent')
def play_game():
    speech = "안녕하세요"
    return statement(say.Korean(speech)).add_speech(say.English("Hello"))

if __name__ == "__main__":
    app.config['CLOVA_VERIFY_REQUESTS'] = False
    app.run(port='5000', debug=True)

Test

>> pip install -r requirements-dev.txt
>> python -m unittest discover test/

WorkToDO

Response

  • not in progress
    • card
    • directives

statement

  • support shouldEndSession true
    • SimpleSpeech
    • SpeechList
    • SpeechSet

question

  • support shouldEndSession false
    • SimpleSpeech
    • SpeechList
    • SpeechSet

repromt

  • support repromt message
    • SimpleSpeech
    • SpeechList
    • SpeechSet

Request

Verify

  • verify application id
    • verify

LaunchRequest

  • when extension launched
    • handler

SessionEndedRequest

  • when extension terminated
    • handler

IntentRequest

  • request with user intent
    • handler

Glboal Request Attr

  • Globalize variables in request
    • request
    • session
    • version
    • context