Closed x-thompson3 closed 4 years ago
Sorry for the delay, haven't had much time to look at this. Is this problem still recurring?
Looking at the source from the most recent version, (0.1.12) link, the send code is really pretty simple. It just posts the message to the MS Teams webhook defined on class init. It relies on the webservice to report success/failure based on the http status code. Anything other than a 200 will raise an exception. requests source
def send(self):
headers = {"Content-Type":"application/json"}
r = requests.post(
self.hookurl,
json=self.payload,
headers=headers,
proxies=self.proxies,
timeout=self.http_timeout,
verify=self.verify,
)
if r.status_code == requests.codes.ok:
return True
else:
raise TeamsWebhookException(r.text)
If this is still recurring, maybe the message is getting hung up on the MS side? Is there anything non-standard about your Teams implementation or your network that could interfere with communication?
I'm not sure there's much I can do with the info that's been provided.
requested additional info, none provided.
The limitations of the webhook implementation prevent pymsteams to know anything other than the http status code returned by the teams API.
Hi. I tried giving some bogus webhook and bogus channel. API is returning back true.
Webhook=“https://outlook.office.com/bogus” myTeamsMessage = pymsteams.connectorcard(Webhook) myTeamsMessage.text(test) _r = myTeamsMessage.send() _r True
What is the best way to capture the true response code?
Describe the bug connector_card.send() sometimes returns True even when the message does not appear in the channel. We have retry logic structure in place to attempt to send a message 3 times. Twice now, the connector_card.send() returned True but did not send a message to the Teams channel.
To Reproduce Steps to reproduce the behavior: Unable to consistently reproduce, but has happened at least twice.
Expected behavior When connector_card.send() returns True, the message within the connector_card should show up in the appropriate teams channel.
Additional context Our codebase uses a helper function to send a given message to a given channel_url. The channel_url is stored in config files. If the response from connector_card.send() is True, we return the response. If an Exception is thrown, we print the Exception and retry. See below: