Skip to content

Conversation

@simonprydden
Copy link
Contributor

closes #48434


^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in airflow-core/newsfragments.

@eladkal
Copy link
Contributor

eladkal commented Mar 27, 2025

Are the changes backward compatible for the users of the provider?

@simonprydden
Copy link
Contributor Author

Are the changes backward compatible for the users of the provider?

The migration notes are simple find and replace, except this one quote, which might be breaking as that it the one causing the test to fail. Just trying to debug now

Note, the Change Events API client has been merged into the Events API v2 client because the former API is effectively a component of the latter. The differences are trivial enough to support both use cases with a single client class, and there are no method or property name collisions between the two original classes.

@simonprydden
Copy link
Contributor Author

@eladkal

I think the new library is missing return on the function, see below
https://github.com/PagerDuty/pdpyras/blob/bb0790beb2831129c6ae018470a5e66a7e487611/pdpyras.py#L1475

    def send_change_event(self, **properties):
        """
        Send a change event to the v2 Change Events API.

        See: https://developer.pagerduty.com/docs/events-api-v2/send-change-events/

        :param **properties:
            Properties to set, i.e. ``payload`` and ``links``
        :returns:
            The response ID
        """
        event = deepcopy(properties)
        response = self.post('/v2/change/enqueue', json=event)
        response_body = try_decoding(successful_response(
            response,
            context="submitting change event",
        ))
        return response_body.get("id", None)

https://github.com/PagerDuty/python-pagerduty/blob/2864c72042fcff746c7377de91fcf76d3d63815e/pagerduty.py#L1407C1-L1437C11

    def send_change_event(self, payload={}, links=[], routing_key=None):
        """
        Send a change event to the v2 Change Events API.

        See: https://developer.pagerduty.com/docs/events-api-v2/send-change-events/

        :param payload:
            A dictionary object with keys ``summary``, ``source``, ``timestamp`` and
            ``custom_details`` as described in the above documentation.
        :param links:
            A list of dictionary objects each with keys ``href`` and ``text``
            representing the target and display text of each link
        :param routing_key:
            (Deprecated) the routing key. The parameter is set automatically to the
            :attr:`ApiClient.api_key` property in the final payload and this argument is ignored.
        :returns:
            The response ID
        """
        if routing_key is not None:
            deprecated_kwarg(
                'routing_key',
                method='EventsApiV2Client.send_change_event'
            )
        event = {'payload': deepcopy(payload)}
        if links:
            event['links'] = deepcopy(links)
        response = self.post('/v2/change/enqueue', json=event)
        response_body = try_decoding(successful_response(
            response,
            context="submitting change event",
        ))

going to open a ticket as the docstring of the function say there should be response id

@eladkal
Copy link
Contributor

eladkal commented Apr 1, 2025

going to open a ticket as the docstring of the function say there should be response id

Did you report the issue to the upstream library? is there an issue to track?

@eladkal
Copy link
Contributor

eladkal commented Apr 1, 2025

OK found it PagerDuty/python-pagerduty#38

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate from pdpyras to pagerduty

2 participants