redash
redash copied to clipboard
Support utf-8 for webhook
Issue Summary
When webhook message contains utf-8 chars, the requests.post will cause a traceback.
Steps to Reproduce
- Send an webhook alert contains utf-8 chars.
- This line code will cause a traceback. https://github.com/getredash/redash/blob/6b1e91012654cda91a4fb64075197b8b3be2cd44/redash/destinations/webhook.py#L45
Technical details:
- Redash Version:latest
- Browser/OS: linux
- How did you install Redash: docker image
example code for test
import requests
try:
resp = requests.post(
"https://example.com",
data="你好",
headers={},
timeout=5.0,
)
except Exception as e:
print(e)
resp = requests.post(
"https://example.com",
data="你好".encode("utf-8"),
headers={},
timeout=5.0,
)
print(resp.status_code)