line-bot-sdk-python
line-bot-sdk-python copied to clipboard
async api error catch
System Informations
- Python version: 3.10.12
- SDK version: 3.11.0
Expected Behavior
If line api get http status code in 200<= X <300, this should get the LineBotApiError in async_api.py line: 2562
Current Behavior
But it cause, 2024-10-17 14:36:48,548 - root - INFO - error: object method can't be used in 'await' expression
File "/home/azureuser/VHS_short_bk/venv/lib/python3.10/site-packages/linebot/async_api.py", line 2567, in __check_error error=Error.new_from_json_dict((await response.json)), TypeError: object method can't be used in 'await' expression
The error cause in async_api.py line 2567, and I change the line """ await response.json """ to """ response.json() """ It got the correct action.
2024-10-17 14:41:49,277 - root - INFO - error: LineBotApiError: status_code=400, request_id=
I got the error message that I want.