alexbegg opened a new pull request #11151: URL: https://github.com/apache/airflow/pull/11151
<!-- Thank you for contributing! Please make sure that your code changes are covered with tests. And in case of new features or big changes remember to adjust the documentation. Feel free to ping committers for the review! In case of existing issue, reference it using one of the following: closes: #ISSUE related: #ISSUE How to write a good git commit message: http://chris.beams.io/posts/git-commit/ --> Updating the "pagerduty" provider's `PagerdutyHook` to no longer use the "pypd" dependency which is now deprecated and instead use the "[pdpyras](https://github.com/PagerDuty/pdpyras)" package which replaced it (both are official PagerDuty python clients). ### PagerdutyHook.create_event The updated `PagerdutyHook.create_event` method takes the same params as before but with an additional optional `images` param. It returns the same response dictionary as before. It is now using the `pdpyras.EventsAPISession` class which is a session class for submitting events to the PagerDuty Events API v2. ### PagerdutyHook.get_session There is an additional `PagerdutyHook.get_session()` method which returns a `pdpyras.APISession` for use with sending or receiving data through the PagerDuty REST API. Because the updated `PagerdutyHook.create_event` method does not use the PagerDuty API token at all (it only uses the `routing_key`) I had to find another use of the API token, and the `PagerdutyHook.get_session()` method will actually make use of the API token. When using the method to get an API session, you are able to use any of the methods defined in the [pdpyras documentation](https://pagerduty.github.io/pdpyras/). The intention of this PR is to both update `PagerdutyHook.create_event` to use the newer `pdpyras` package and to have a starting off point for adding additional methods for the PagerDuty REST API to this hook in the future as needed. I did not include other methods because I didn't want to just fully port over all of the `pdpyras.APISession` methods into this hook and I think it is enough for a user of the hook to be able to use the APISession as needed. --- **^ Add meaningful description above** Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst#pull-request-guidelines)** for more information. In case of fundamental code change, Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvements+Proposals)) is needed. In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x). In case of backwards incompatible changes please leave a note in [UPDATING.md](https://github.com/apache/airflow/blob/master/UPDATING.md). ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
