Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Paste
P33166
(An Untitled Masterwork)
Active
Public
Actions
Authored by
herron
on Aug 25 2022, 10:18 PM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Tags
None
Referenced Files
F35490263: raw-paste-data.txt
Aug 25 2022, 10:18 PM
2022-08-25 22:18:58 (UTC+0)
Subscribers
None
# quick-n-dirty new incident example via dispatch api
import requests
import json
login_endpoint = 'https://dispatch-keith.wmcloud.org/api/v1/wikimedia/auth/login'
login_data = '{ "email": "me@email.address", "projects": [ ], "organizations": [ ], "password": "secret" }'
login = requests.post(login_endpoint, data=login_data, headers='').json()
headers = f"""{{"Authorization": "Bearer {login['token']}"}}"""
pita = json.loads(headers)
incident_endpoint = 'https://dispatch-keith.wmcloud.org/api/v1/wikimedia/incidents'
new_incident_data = '{ "title": "testing", "description": "testing api creation", "project": { "name": "sre" }, "incident_priority": { "name": "Unbreak Now!" }, "incdient_type": { "name": "Outage" } }'
print(requests.post(incident_endpoint, data=new_incident_data, headers=pita).json())
Event Timeline
herron
created this paste.
Aug 25 2022, 10:18 PM
2022-08-25 22:18:58 (UTC+0)
herron
mentioned this in
T313230: Dispatch IRC Integration
.
Log In to Comment