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
[Feature Request] Asynchronous/Asyncio support #101
Comments
I've made my own, closing this as no high interest in it. |
@Shivelight can you merge your solution with this |
@alfredfrancis I don't think my solution is good to merge with this; it is a duplicate code infused with async-await. I'm not a pro, but in my opinion, a better solution might be architecture change that allows you to use sync and async HTTP client interchangeably. Personally, I like osuapi connectors solution. Whatever the solution is, it's the maintainer decision. |
If we're dropping Python 3.6- support in the next major release, we can support async natively. Is it time to support async? |
A yes from me, that would be awesome 🎉 |
|
I've just released aiolinebot, async api client library - strictly saying, not client library but async client generator from line-bot-sdk. https://github.com/uezo/aiolinebot This is a kind of hack, but by this way it's easy to keep up-to-date with the API updates until async is officially supported.(very soon?) I hope this will be help for you and our community😃 |
quoting #310 for those who want a quick solution of webhook part pls use https://github.com/codustry/line-bot-sdk-python/tree/async-support-for-handler by pip or handler = WebhookHandlerV2(settings.LINE_SECRET)
@router.post("/line")
async def handle_line_webhook(
request: Request,
signature: str = Header(None, alias="X-Line-Signature")
):
# get request body as text
body = await request.body()
body = body.decode()
# handle webhook body
try:
await handler.handle_async(body, signature)
except InvalidSignatureError as e:
print(
"Invalid signature. Please check your channel access token/channel secret."
)
raise e
@handler.add(MessageEvent, message=TextMessage)
async def handle_message(event: MessageEvent):
response_to_magic_word(event) This comes from a fastapi framework chatbot. And a plus that https://github.com/uezo/aiolinebot is fully compatible with https://github.com/codustry/line-bot-sdk-python/tree/async-support-for-handler 🥰 |
I created new PR #340 to support this feature. If you have any comments on the PR(especially interface), feel free to submit a comment to the PR. |
It would be nice if asynchronous processing natively supported. I think this feature is necessary and reasonably easy to implement without breaking any code or compatibility as we only need to write new API and HTTP client that support async.
If you agree with this or maybe you have a better idea, I would be happy to work on it.
EDIT: I thought I was writing a commit message, here are some sparkles ✨ ✨ ✨
The text was updated successfully, but these errors were encountered: