Created
March 16, 2021 08:14
-
-
Save 4heck/b8d7b7fa3f8048d83e8097e5c4664914 to your computer and use it in GitHub Desktop.
telegram_snippet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
TELEGRAM_TOKEN = os.environ.get("TELEGRAM_BOT_TOKEN", "") | |
TELEGRAM_CHAT_ID = os.environ.get("TELEGRAM_CHAT_ID", "") | |
TELEGRAM_SEND_MESSAGE_URL_TEMPLATE = ( | |
f"https://api.telegram.org/bot{TELEGRAM_TOKEN}/sendMessage?" | |
f"chat_id={TELEGRAM_CHAT_ID}&text={{}}&disable_web_page_preview=True" | |
) | |
... | |
... | |
url = settings.TELEGRAM_SEND_MESSAGE_URL_TEMPLATE.format(TEXT_MESSAGE) | |
... | |
... | |
response = requests.request("POST", url, data=data) | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment