All Projects → shirok1 → e5-api-renew-scf

shirok1 / e5-api-renew-scf

Licence: other
本项目已进入半废弃状态(因为我自己的开发者订阅在2020年12月掉了)所以这里可能只能提供基础技术指导——[腾讯云函数专用]通过重复调用MS Graph API来试图续订Office 365开发者试用

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to e5-api-renew-scf

tencent-tensorflow-scf
A template project for serverless functions for Tensorflow inference on Tencent Cloud.
Stars: ✭ 38 (-2.56%)
Mutual labels:  tencent-cloud, tencent-scf
Office Tool
© 2016-2021 Yerong. All Rights Reserved.
Stars: ✭ 3,657 (+9276.92%)
Mutual labels:  office-365
Onedrive
#1 Free OneDrive Client for Linux
Stars: ✭ 5,104 (+12987.18%)
Mutual labels:  office-365
office-mygroups-react
This application shows the list of your Office 365 Groups retrieved using the Microsoft Graph.
Stars: ✭ 27 (-30.77%)
Mutual labels:  office-365
OotD
Outlook on the Desktop (OotD)
Stars: ✭ 76 (+94.87%)
Mutual labels:  office-365
pnp-starterkit-setup
x-platform setup script for the SharePoint Starter Kit
Stars: ✭ 14 (-64.1%)
Mutual labels:  office-365
tencent-cam-role
Easily provision Tencent CAM roles using Serverless Components
Stars: ✭ 19 (-51.28%)
Mutual labels:  tencent-cloud
serverless-tencent-scf
Add support for Tencent Cloud's serverless infrastructure to the Serverless Framework via this plugin
Stars: ✭ 53 (+35.9%)
Mutual labels:  tencent-cloud
qcloud-cos-client
Tencent COS Client
Stars: ✭ 35 (-10.26%)
Mutual labels:  tencent-cloud
qcloud-im-server-sdk-java
☁ Tencent Cloud IM Server SDK in Java | 腾讯云 IM 服务端 SDK Java 版
Stars: ✭ 38 (-2.56%)
Mutual labels:  tencent-cloud
scf-headless-chrome
Headless chrome running on tencent serverless cloud function.
Stars: ✭ 28 (-28.21%)
Mutual labels:  tencent-cloud
tencent-scf
Deploy Tencent Cloud Serverless Cloud Function in seconds with Serverless Components.
Stars: ✭ 86 (+120.51%)
Mutual labels:  tencent-cloud
omegat-tencent-plugin
This is a plugin to allow OmegaT to source machine translations from Tencent Cloud.
Stars: ✭ 31 (-20.51%)
Mutual labels:  tencent-cloud
tencent-apigateway
Easily provision Tencent API Gateway using Serverless Components
Stars: ✭ 33 (-15.38%)
Mutual labels:  tencent-cloud
laravel-filesystem-cos
Tencent Cloud COS storage for Laravel based on overtrue/flysystem-cos.
Stars: ✭ 56 (+43.59%)
Mutual labels:  tencent-cloud
flutter superplayer
适用于 Flutter 的腾讯云超级播放器插件
Stars: ✭ 13 (-66.67%)
Mutual labels:  tencent-cloud
tencent-cam-policy
Easily create an Tencent CAM Policy with Serverless Components
Stars: ✭ 20 (-48.72%)
Mutual labels:  tencent-cloud
CloudMinecraft
Create a minecraft server with TencentCloud API when the worlds are saved in another Student's Cloud.
Stars: ✭ 11 (-71.79%)
Mutual labels:  tencent-cloud
js
serverless your express/koa/restify apps
Stars: ✭ 21 (-46.15%)
Mutual labels:  tencent-cloud
ExampleForSCF
腾讯云SCF(云函数)、Github Actions的python脚本,用于每天自动签到,一个是吾爱破解论坛的一个是哔哩哔哩的,作为我了解SCF的示例。
Stars: ✭ 120 (+207.69%)
Mutual labels:  tencent-scf

E5 Renew SCF

如题,原版刷API脚本的修改版,单次执行,专门用于腾讯云的无服务器云函数。

配置

参数获取请参见office e5刷API脚本分享以及教程E5刷API脚本分享以及教程(后面这个有图)。

入口函数为index.exe

需要预先配置以下环境变量:

Region:该云函数所在服务器地域,地域代码参见地域列表

refresh_tokenrclone所获取的同名参数,点击这里下载rclone

ms_id:Azure AD上的应用程序(客户端) ID

ms_secret:Azure AD上的客户端密码(不是用户密码)

SecretIdSecretKey:先到腾讯云API密钥管理创建,用于刷新环境变量中的refresh_token

如果你有新的API要加入,只要请求的header格式一致,可以直接加入api_list列表(那两个messageRules是原本就有两条的,我暂且蒙在鼓里)。

另外,云函数不会自己运行,请自行设置触发器。

如果你想使用子账号,请注意给予的权限中要包括以下Action:

Action名称 描述
GetFunction 获取函数详情
UpdateFunctionConfiguration 更新函数配置
SetTrigger(仅设置随机时间需要,下同) 设置函数触发器
UpdateTrigger 更新触发器配置
DeleteTrigger 删除函数触发器

随机时间

原本的设想是直接删除旧的触发器,然后添加一个随机时间的触发器,没想到居然不行。

[TencentCloudSDKException] code:FailedOperation.CreateTrigger message:创建触发器失败 (当前函数状态无法进行此操作)

明明连修改环境变量都可以……没办法,不能在一个函数内实现随机时间了。(除非你想靠sleep(random())卡时间,但这样会浪费不少计费时间)

如果你不嫌麻烦的话,确实可以通过两个函数互相调用来实现随机时间。

A+B类型

通过用两个具有完整功能的函数互相设置定时触发器来实现。

环境变量:

TrigUpdateTypeAB

注意:云函数提供了包括环境变量在内的复制功能。使用复制功能前不要在环境变量中填写refresh_token

AnotherFunctionName:另一个函数的FunctionName

AnotherRegion:(可选)另一个函数的Region,默认相同

AnotherNamespace:(可选)另一个函数的Namespace,默认相同

random_time_lowerlimitrandom_time_toplimit:(可选)随机时间的下限、上限,默认150、300(秒)

TriggerName:(可选)触发器的名称,每次更新都会先删除这个名字的触发器再添加一个同名的,默认值为RandomTimer

无论使用哪种类型,建议只设置一个api触发器,因为程序在初次运行后,就能自动递归触发下一次。

响应

目前还想不到能响应什么有用的东西,毕竟大部分时间都是无值守运行。

所有print()的输出请到云函数的运行日志查看。

消耗

测试挂了一天,设置的触发器每5分钟触发一次,共使用资源约120GBs,出流量0.01GB,完全不会超出免费额度;另外,每次触发平均耗时4s,内存消耗基本都在20MB左右。

TODO

  • 自行递归添加下一个触发器(以实现真正随机时间而不是靠sleep(random())卡时间实现)

  • 搞懂为什么不能在定义全局变量的时候用环境变量赋值

目前自行定义的环境变量和一些会有变动的环境只能在入口函数中获取,是因为是在调用入口函数的时候注入的。——腾讯云工作人员回复(为什么不写在文档里?)

  • 把那些手打的params用字典转json代替(对于那种连多打一个逗号都要报错的解析器表示强烈cnm

  • 欢迎issue。

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].