From d013c45cbf310d9f5129383047f18a1cbf9ac376 Mon Sep 17 00:00:00 2001 From: Phillip Shea Date: Fri, 28 Aug 2015 10:27:34 -0700 Subject: [PATCH] Deprecate REST functions in UtilLibrary.py Robot RequestsLibary should be used instead. Change-Id: If6af408e1095a088c3137c291011186c81bf3b4e Signed-off-by: Phillip Shea --- csit/libraries/UtilLibrary.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/csit/libraries/UtilLibrary.py b/csit/libraries/UtilLibrary.py index 05ef69ab37..ed2de6b18a 100644 --- a/csit/libraries/UtilLibrary.py +++ b/csit/libraries/UtilLibrary.py @@ -10,13 +10,17 @@ from SSHLibrary import SSHLibrary import robot import time import re +import warnings global _cache def get(url, userId='admin', password='admin'): """Helps in making GET REST calls""" - + warnings.warn( + "Use the Robot RequestsLibrary rather than this. See DatastoreCRUD.robot for examples", + DeprecationWarning + ) headers = {} headers['Accept'] = 'application/xml' @@ -30,6 +34,10 @@ def get(url, userId='admin', password='admin'): def nonprintpost(url, userId, password, data): """Helps in making POST REST calls without outputs""" + warnings.warn( + "Use the Robot RequestsLibrary rather than this. See DatastoreCRUD.robot for examples", + DeprecationWarning + ) if userId is None: userId = 'admin' @@ -49,6 +57,10 @@ def nonprintpost(url, userId, password, data): def post(url, userId, password, data): """Helps in making POST REST calls""" + warnings.warn( + "Use the Robot RequestsLibrary rather than this. See DatastoreCRUD.robot for examples", + DeprecationWarning + ) if userId is None: userId = 'admin' @@ -74,6 +86,10 @@ def post(url, userId, password, data): def delete(url, userId='admin', password='admin'): """Helps in making DELET REST calls""" + warnings.warn( + "Use the Robot RequestsLibrary rather than this. See DatastoreCRUD.robot for examples", + DeprecationWarning + ) print("delete all resources belonging to url"+url) session = _cache.switch("CLUSTERING_DELETE") resp = session.delete(url, auth=(userId, password)) # noqa -- 2.36.6