Build a Webhook for a Chatbot Using Python
-
下载VSC
-
Build a Webhook for a Chatbot Using Python
-
安装python和插件
可以参考「Python入门」python环境搭建及VScode使用python运行方式
运行的时候报错
- No module named ‘requests’
- No module named ‘flask’
在vsc的终端运行
pip install flask 安装
pip show flask 查看 flask 是否安装完成pip install requests
pip show requests 查看 requests 是否安装完成
# if you don't have pip in your PATH:
python -m pip install requestspython3 -m pip install requests# Windows
py -m pip install requests# Anaconda
conda install -c anaconda requests# Jupyter Notebook
!pip install requests
可以参考 How to fix ModuleNotFoundError: No module named ‘requests’
Test it again but this time sending the following (raw) body, to simulate as if the chatbot were sending the request:
{"conversation": {"memory": {"animal" : {"raw" : "snail"},"funfacts": 1}}
}