New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fastapi 和 unicorn 实现的可热重启bot示例 #18
Conversation
fastapi 和 unicorn 实现的可热重启bot示例,可以实现web api定制。
@fangjiyuan Please sign cla agreement and make CI green. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your PR, I have left some comments for it, I hope you can modify according to it to merge this PR~
examples/hotreload_bot.py
Outdated
except Exception as e: | ||
log.exception(e) | ||
return 404 | ||
async def send_report(bot,str,str2,str3): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
建议这里将 str,str2,str3
换为其他变量名,体现变量的含义
async def send_msg(item:Item,bot=Depends(bot)): | ||
try: | ||
await send_report(bot,item.msg_type,item.name,item.contact_id) | ||
return 200 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
接口返回值建议改为如下格式
{
'code': 100010, # error code
'detail': detail, # show for user
'fields': fields, # show for dev, list
'success': true # suc or fail
'data': data, # data if success else null, be list or dict
}
以符合 RESTful 规范,下同
去掉了绝对路径 修改了变量名
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thank you very much for your contribution! You are welcome to join Wechaty Contributor Program1. Join Wechaty Organization
I have invited you to join our Wechaty GitHub Organization, please accept it by following the above message. (See also: wechaty/PMC#16) 2. Update Your Wechaty Contributor Profile
3. Join The Contributor Only WeChat RoomWe also have a WeChat room for contributors only which can discuss Wechaty at a deeper level, you are welcome to join and if you are interested. Please add @lijiarui wechat: ruirui_0914 and send her this pr link. She will invite you into Wechaty Contributor Room Cheers! |
fastapi 和 unicorn 实现的可热重启bot示例,可以实现web api定制。