BILI_judgement
BILI_judgement copied to clipboard
腾讯云函数的执行方式
想问一下执行方式应该填啥
脚本丢到腾讯云函数上
执行方式填judgement.main_handler会报错找不到main_handler;
填judgement.main会报错给定了两个main
经过查看其他issue里的回复和大佬的指点,解决方法:
执行方式填judgement.main_handler
在judgement.py最后加上
# Tencent SCF
def main_handler(event, context):
run()
return
# Aliyun FC
def handler(event, context):
run()
return
def run(*args, **kwargs):
configData = load_config()
loop = asyncio.new_event_loop()
loop.run_until_complete(main(configData))
同时把201-207行修改为
def load_config():
'''加载配置文件'''
if os.path.exists('config/config.json'):
with open('config/config.json', 'r', encoding='utf-8') as fp:
return json.loads(fp.read(), object_pairs_hook=OrderedDict)
else:
raise RuntimeError('未找到配置文件')
这样应该能运行,不过推送好像失效了