dashboard_duty.py 文件源码

python
阅读 32 收藏 0 点赞 0 评论 0

项目:dashboard-duty 作者: jrasell 项目源码 文件源码
def _get_url(self, payload, endpoint):
        """
        Performs a GET request to the PD API endpoint with the payload.
        If a 200 response is received the response data is returned.

        :param payload: The GET payload to send to the PD API
        :param endpoint: The PagerDuty endpoint, appended to api.pagerduty.com
        :return: The response data from the PD endpoint
        """
        url = 'https://api.pagerduty.com/%s' % endpoint
        try:
            r_data = self._s.get(url, params=payload)
            if r_data.status_code != 200:
                logging.error('PagerDuty API returned a status code of %s'
                              % r_data.status_code)
            return r_data.json()
        except Exception, e:
            logging.error(e)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号