WebexPythonSDK icon indicating copy to clipboard operation
WebexPythonSDK copied to clipboard

ApiError [502] Bad Gateway while creating message

Open Rkhoiwal opened this issue 2 years ago • 0 comments


def respond_to_message(CARD_CONTENT_LIST):
"""Respond to a message to our bot"""

for CARD_CONTENT in CARD_CONTENT_LIST:
api.messages.create(
target_room_id,
text="Change Validation Card",
attachments=[{
"contentType": "application/vnd.microsoft.card.adaptive",
"content": CARD_CONTENT
}],
)

return "OK"

         try:
            respond_to_message(CARD_CONTENT_LIST)
        except:
            api.messages.create(roomId=target_room_id, text="Error in Submitting Data: {}  Please try again".format(sys.exc_info()))
            sys.exit(1)

Getting below error which is intermittent when calling respond_to_message function:


Error in Submitting Data: (<class 'webexteamssdk.exceptions.ApiError'>, <ApiError [502] Bad Gateway>, <traceback object at 0x7fd51a5aea80>) Please try again

Error in Submitting Data: (<class 'requests.exceptions.ConnectionError'>, ConnectionError(ProtocolError('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))), <traceback object at 0x7fd5198facc0>) Please try again


Rkhoiwal avatar Oct 12 '23 09:10 Rkhoiwal