22 lines
525 B
Python
22 lines
525 B
Python
|
from json import dumps
|
||
|
import requests
|
||
|
import secrets_loader
|
||
|
|
||
|
secrets = secrets_loader.SecretsLoader()
|
||
|
|
||
|
WEBHOOK_URL = secrets.load_or_fail('WEBHOOK_URL')
|
||
|
|
||
|
def main():
|
||
|
"""Google Chat incoming webhook quickstart."""
|
||
|
app_message = {"text": "Hello from a Python script!"}
|
||
|
message_headers = {"Content-Type": "application/json; charset=UTF-8"}
|
||
|
response = requests.post(
|
||
|
WEBHOOK_URL,
|
||
|
headers=message_headers,
|
||
|
json=app_message,
|
||
|
)
|
||
|
print(response)
|
||
|
|
||
|
if __name__ == '__main__':
|
||
|
main()
|