Clova Extension Kit SDK for Python

This is a python library to simplify the use of the Clova Extensions Kit (CEK). If you want to create your own service, you first need to create your own Extension.

Quick start

  1. Create a cek.clova.Clova instance.
import os
from cek import Clova

# application_id is used to verify requests.
application_id = os.environ.get("APPLICATION_ID")
# Set debug_mode=True if you are testing your extension. If True, this disables request verification
clova = Clova(application_id=application_id, default_language="ja", debug_mode=False)
  1. Define request handlers for CEK (on LaunchRequest, IntentRequest, etc).
def launch_request_handler(clova_request):
    return clova.response("こんにちは世界。スキルを起動します")

def default_handler(clova_request):
    return clova.response("もう一度お願いします")
  1. Setup a web API endpoint. Use cek.clova.Clova.route() to route requests.
from flask import Flask, request, jsonify

app = Flask(__name__)

@app.route('/app', methods=['POST'])
def my_service():
    resp = clova.route(, request.headers)
    resp = jsonify(resp)
    # make sure we have correct Content-Type that CEK expects
    resp.headers['Content-Type'] = 'application/json;charset-UTF-8'
    return resp
  1. Save as and run app flask run

For a detailed example, see clova-cek-sdk-python-sample example extension. See also the API documentation to know how to use the SDK.

Meta information

Indices and tables