synthetics.py 文件源码

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

项目:newrelic-cli 作者: NativeInstruments 项目源码 文件源码
def get_monitor_script(self, name):
        # we will need monitor ID. So get the monitor object first
        monitor = self.get_monitor_by_name(name)
        if not monitor:
            raise ItemNotFoundError('Monitor {} not found'.format(name))

        url = '{}/v3/monitors/{}/script'.format(self.base_url, monitor['id'])
        try:
            r = self._get(
                url,
                headers=self.default_headers,
                timeout=self.timeout
            )
        # Make error message more specific
        except ItemNotFoundError:
            raise ItemNotFoundError(
                'Script for monitor {} not found'
                .format(name)
            )
        script_base64 = r.json()['scriptText']
        script = base64.b64decode(script_base64)
        return script
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号