Skip to content
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

async api error catch #686

Open
m124578n opened this issue Oct 17, 2024 · 0 comments
Open

async api error catch #686

m124578n opened this issue Oct 17, 2024 · 0 comments
Labels

Comments

@m124578n
Copy link

m124578n commented Oct 17, 2024

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=, error_response={"details": [{"message": "cannot contain null elements", "property": "/body/contents"}], "message": "A message (messages[0])\u00a0in the request body is invalid"}, headers={'server': 'legy', 'cache-control': 'no-cache, no-store, max-age=0, must-revalidate', 'content-type': 'application/json', 'date': 'Thu, 17 Oct 2024 06:41:49 GMT', 'expires': '0', 'pragma': 'no-cache', 'x-content-type-options': 'nosniff', 'x-frame-options': 'DENY', 'x-line-request-id': , 'x-xss-protection': '1; mode=block', 'content-length': '152'}

I got the error message that I want.

@m124578n m124578n added the bug label Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant