24 lines
2.1 KiB
Python
24 lines
2.1 KiB
Python
import requests
|
|
|
|
url = "https://hooks.slack.com/services/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"
|
|
|
|
querystring = {"":""}
|
|
|
|
payload = "{\"attachments\": [\n {\n \"title\": \"Let's check the latest updates from Highways England as of 22:30:12! \\ud83d\\ude93\\ud83d\\udea8\",\n \"pretext\": \"Did someone say M62!? \\ud83d\\ude27\",\n \"text\": \"\",\n \"mrkdwn_in\": [\"text\", \"pretext\"],\n \"footer\": \"ec2-54-246-210-90.eu-west-1.compute.amazonaws.com\",\n \"footer_icon\": \"https://i.imgur.com/ADsI87O.png\",\n \"ts\": \"1570917914\",\n \"fields\": [\n\t\t \t{\n\t\t \"title\": \"There are currently 1 reported congestion incidents on the M62 😱\",\n\t\t \"value\": \"Location : The M62 westbound exit slip at junction J32 .\\n Reason : Congestion.\\n Status : Currently Active.\\n Return To Normal : Normal traffic conditions are expected between 23:00 and 23:15 on 12 October 2019.\\n Delay : There are currently delays of 10 minutes against expected traffic.\",\n\t\t \"short\": false\n\t\t \t},\n\t\t \t{\n\t\t \"title\": \"Accident Incidents\",\n\t\t \"value\": \"There are currently no reported accident incidents on the M62 \\ud83e\\udd14\",\n\t\t \"short\": false\n\t\t \t},\n\t \t\t{\n\t\t \"title\": \"\",\n\t\t \"value\": \"Hey Andy, have you thought about getting the train? \\ud83d\\ude85 \",\n\t\t \"short\": false\n\t\t \t}\n\t \t]\n }\n ]\n}"
|
|
headers = {
|
|
'Content-Type': "application/json",
|
|
'User-Agent': "PostmanRuntime/7.17.1",
|
|
'Accept': "*/*",
|
|
'Cache-Control': "no-cache",
|
|
'Postman-Token': "a4b63f2d-43b1-4ce7-898a-2fd03952ad7d,46ba7deb-472c-4328-a261-9c2000da2f11",
|
|
'Host': "hooks.slack.com",
|
|
'Accept-Encoding': "gzip, deflate",
|
|
'Content-Length': "1277",
|
|
'Connection': "keep-alive",
|
|
'cache-control': "no-cache"
|
|
}
|
|
|
|
response = requests.request("POST", url, data=payload.encode(), headers=headers, params=querystring)
|
|
|
|
print(response.text)
|