stdin2discord: get webhook url from env var
Some checks failed
Push commit / report (push) Failing after 3s

This commit is contained in:
a31 2023-09-09 18:43:48 +03:00
parent 222796d9ad
commit c874a29c5a

View File

@ -1,12 +1,13 @@
import sys
import requests
import os
def send(_msg: str):
if len(_msg) == 0:
return
r = requests.post(
url='https://discord.com/api/webhooks/936927833572380692/QrqoK8aVCOkGFh1L0HaHPd_Z-Usj-ubhXYvHadZyCA1Y5GOB7-0xWmuyKI9l4byvKjQ1',
url=os.environ['DISCORD_WEBHOOK'],
data=f'content=```diff\n{requests.utils.quote(_msg)}```'.encode('utf-8'),
headers = {'Content-Type': 'application/x-www-form-urlencoded'}
)