python-wechaty
python-wechaty copied to clipboard
Feature Request: RESTFUL API should be supported in python-wechaty
Original Intention
In these days, some developers try to add more abilities to bot, eg: saving chat history, enable restapi in python-wechaty bot and sync the messages between specific rooms. The first one has been accompished, So I wanna to get second done in next days.
What does RESTFUL API look like ?
talk is cheap, show the mvp code.
from wechaty import Wechaty, WechatyPlugin
class Bot(Wechaty):
async def register_blueprints(self, app):
@app.route('/hello-bot')
async def say_hello():
pass
class MessagePlugin(WechatyPlugin):
async def register_blueprints(self, app):
@app.route('/send-message-to-my-baby')
async def say_morning():
pass
Once you register your blueprint to app, swagger-doc will be generated by default. Above code is simple but powerful. Do you think so ?
Web Frameworks
There are some great async-based web frameworks, and I will choose the popular & fast one in the design. Please give yourself suggestion: What do you choose ? and Why do you choose it ?
Frameworks:
- FastApi
- Flask 2.0.x
- Sanic
- Tornado
- Vibora
- Quart
I choose FastApi and Quart.
I choose FastApi and Quart.
Can you give the reason why you choose it ?
I choose FastApi because it is async-friendly and can automatically generate Swagger-API.
I choose FastApi and Quart.
Can you give the reason why you choose it ?
FastApi can make route,its usefull for me.Quart is a async-based web framework like flask.