From 0949603bfb00c66292676ce981c6947580d59334 Mon Sep 17 00:00:00 2001 From: Olivier Desenfans Date: Wed, 13 Sep 2023 12:09:40 +0200 Subject: [PATCH] Fix: support 405 from POST /messages in broadcast fallback Problem: a user reports that publishing a message falls because of a 405 error returned from `POST /messages`. The fallback only takes 404 into account, but a 405 is actually more likely because `GET /messages` exists. Solution: accept both 404 and 405 as a sign that the node does not support `POST /messages`. --- src/aleph/sdk/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aleph/sdk/client.py b/src/aleph/sdk/client.py index 0b2c1553..520e8bd7 100644 --- a/src/aleph/sdk/client.py +++ b/src/aleph/sdk/client.py @@ -1138,7 +1138,7 @@ async def _broadcast( json={"sync": sync, "message": message_dict}, ) as response: # The endpoint may be unavailable on this node, try the deprecated version. - if response.status == 404: + if response.status in (404, 405): logger.warning( "POST /messages/ not found. Defaulting to legacy endpoint..." )