Page MenuHomePhabricator

raw-paste-data.txt

Authored By
herron
Aug 25 2022, 10:18 PM
Size
813 B
Referenced Files
None
Subscribers
None

raw-paste-data.txt

# 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())

File Metadata

Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
9722585
Default Alt Text
raw-paste-data.txt (813 B)

Event Timeline