Closed vibhutigoel closed 3 years ago
getting the same with rpost.
following the example from the README:
from pdpyras import APISession
api_token = 'your-token-here'
session = APISession(api_token)
payload = {
"type": "incident",
"title": "This is a test 4",
"service": {"id": "service_id", "type": "service_reference"},
"assignments": [{"assignee": {"id": "user_id", "type": "user_reference"}}],
}
pd_incident = session.rpost("incidents", json=payload)
return:
self.pagerDutyDedupKey = self.pagerDutySession.rpost("incidents", json=payload)
File "/usr/local/lib/python3.9/site-packages/pdpyras.py", line 146, in call
r = raise_on_error(method(self, path, **pass_kw))
File "/usr/local/lib/python3.9/site-packages/pdpyras.py", line 82, in raise_on_error
raise PDClientError("%s %s: API responded with non-success status "
pdpyras.PDClientError: POST incidents: API responded with non-success status (400)
ah works for me now, PD requires an extra header called from
for some calls, you can set it when instantiating the class. PagerDutyAPISession("apikey", default_from='test@useremail.com')
This is already noted in the README.
FYI, if more detail about a response is needed (i.e. validation errors), to make it easier to troubleshoot when using any of the methods that raise exceptions for non-2xx response statuses: the response
property of the exception, if non-None
, should be a requests.Response
object. The text
property / json()
method of such an object contains the body, which should contain errors reported by the API, if any.
We are using below function to resolve the incident
suddenly its started throwing below error : PDClientError: PUT /incidents: API responded with non-success status (400)
As per my finding there is some issue with rput Is anything changes in the pagerduty API ? or in pdpyras ?