2020-12-15 12:48:50 +08:00
|
|
|
# 腾讯云函数教程
|
|
|
|
|
2021-05-23 20:01:35 +08:00
|
|
|
### 一、创建云函数
|
2021-03-01 23:13:56 +08:00
|
|
|
|
2021-05-23 20:01:35 +08:00
|
|
|
> 地域选哪里都可以
|
2020-12-15 12:48:50 +08:00
|
|
|
|
2021-05-23 20:01:35 +08:00
|
|
|
![创建云函数](img/scf_create.png)
|
2021-03-01 23:13:56 +08:00
|
|
|
|
2021-05-23 20:01:35 +08:00
|
|
|
```python
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
from dailycheckin.main import checkin
|
2020-12-15 19:08:48 +08:00
|
|
|
|
|
|
|
|
2021-05-23 20:01:35 +08:00
|
|
|
def main_handler(event, context):
|
|
|
|
checkin()
|
|
|
|
```
|
2020-12-15 19:08:48 +08:00
|
|
|
|
2021-05-23 23:17:45 +08:00
|
|
|
### 二、安装依赖包(更新依赖与安装一致)
|
2020-12-15 19:08:48 +08:00
|
|
|
|
2021-05-23 20:01:35 +08:00
|
|
|
![安装依赖包](img/scf_install.png)
|
2021-03-01 23:13:56 +08:00
|
|
|
|
2021-05-23 20:01:35 +08:00
|
|
|
```bash
|
|
|
|
cd src
|
2021-05-23 23:17:45 +08:00
|
|
|
pip3 install dailycheckin --upgrade -t .
|
2021-05-23 20:01:35 +08:00
|
|
|
```
|
2021-03-01 23:13:56 +08:00
|
|
|
|
2021-05-23 20:01:35 +08:00
|
|
|
### 三、添加配置文件
|
2021-03-01 23:13:56 +08:00
|
|
|
|
2021-09-07 16:26:36 +08:00
|
|
|
> ⚠️ 请务必到 [http://www.json.cn](http://www.json.cn) 网站检查 `config.json` 文件格式是否正确!
|
|
|
|
|
2021-05-23 20:01:35 +08:00
|
|
|
![添加配置文件](img/scf_config.png)
|
|
|
|
|
|
|
|
### 四、部署测试
|
|
|
|
|
|
|
|
![部署测试](img/scf_test.png)
|