Deprecate REST functions in UtilLibrary.py 68/26168/2
authorPhillip Shea <phillip.shea@hp.com>
Fri, 28 Aug 2015 17:27:34 +0000 (10:27 -0700)
committerPhillip Shea <phillip.shea@hp.com>
Mon, 31 Aug 2015 22:17:59 +0000 (15:17 -0700)
Robot RequestsLibary should be used instead.

Change-Id: If6af408e1095a088c3137c291011186c81bf3b4e
Signed-off-by: Phillip Shea <phillip.shea@hp.com>
csit/libraries/UtilLibrary.py

index 05ef69ab374ada992473714c97b64244f737328d..ed2de6b18ad8c065b0713e125f5937f4e17859c6 100644 (file)
@@ -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