Created
December 29, 2022 13:22
-
-
Save Teebor-Choka/1d99d438d57af0680266cb33117b5c44 to your computer and use it in GitHub Desktop.
Publish to Google Chat
This file contains hidden or 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
| #!/usr/bin/env python3 | |
| from json import dumps | |
| import os | |
| from httplib2 import Http | |
| def main(): | |
| url = os.environ["GOOGLE_CHAT_URL"] | |
| bot_message = { | |
| 'text': 'REPLACE WITH YOUR TEXT.' | |
| } | |
| message_headers = {'Content-Type': 'application/json; charset=UTF-8'} | |
| http_obj = Http() | |
| response = http_obj.request( | |
| uri=url, | |
| method='POST', | |
| headers=message_headers, | |
| body=dumps(bot_message), | |
| ) | |
| print(response) | |
| if __name__ == '__main__': | |
| main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment