def _try_deleting_ranker(self, ranker_id):
config = load_config()
url, user_id, password = get_rnr_credentials(config)
response = requests.get(path.join(url, 'v1/rankers', ranker_id),
auth=(user_id, password),
headers={'x-global-transaction-id': 'Rishavs app',
'Content-type': 'application/json'})
response_text = json.dumps(response.json(), indent=4, sort_keys=True)
if response.status_code == 200:
self.logger.info('Found a test ranker that needs cleanup: %s' % response_text)
response = requests.delete(path.join(url, 'v1/rankers', ranker_id),
auth=(user_id, password),
headers={'x-global-transaction-id': 'Rishavs app',
'Content-type': 'application/json'})
response.raise_for_status()
self.logger.info("Successfully deleted test ranker: %s" % ranker_id)
else:
self.logger.info('No cleanup required for ranker id: %s (got response: %s)' % (ranker_id, response_text))
test_RankerProxy.py 文件源码
python
阅读 28
收藏 0
点赞 0
评论 0
评论列表
文章目录