用Python做一个简单的今日头条热词Skill


(zhaolin) #1

Skill Python Sample

基础环境

操作系统: CentOS 6.5+

Python version: 2.6+

依赖:

yum install -y python-devel openssl openssl-devel python-pip git libffi-devel
pip install flask requests pyOpenSSL

部署服务

获取sample code
git clone https://github.com/Rokid/rokid-skill-sample.git
cd rokid-skill-sample/rokid-skill-sample-python-toutiao/
获取SSL证书

详见:通过Let’s Encrypt获取免费的SSL证书

git clone https://github.com/Rokid/rokid-skill-tools.git
cd rokid-skill-tools
chmod +x generate-letsencrypt-certificate.sh
SKILL_DOMAIN=填写测试域名
./generate-letsencrypt-certificate.sh $SKILL_DOMAIN
mv $SKILL_DOMAIN.crt ../test_domain.crt
mv $SKILL_DOMAIN.key ../test_domain.key
启动服务
cd .. && python sample-server.py

创建技能

详见:Rokid Skills Start

后端服务:
https://填写测试域名/
意图定义:
{
	"intents": [
		{
			"intent": "query_hot_words",
			"slots": []
		}
	]
}
用户语句:
query_hot_words 今天热词是什么

测试技能


(chao.xuc) #2

(fryfish) #3

你的sample-server.py服务是自己创建的么?


(zhaolin) #4

在gitlub上面有:https://github.com/Rokid/rokid-skill-sample/blob/master/rokid-skill-sample-python-toutiao/sample-server.py


(fryfish) #5

测试域名可以是localhost么?


(zhaolin) #6

不可以,必须是公网可达的服务器