From: Phillip Shea Date: Mon, 31 Aug 2015 22:29:39 +0000 (-0700) Subject: Deprecate REST functions in RequestsLibrary.py X-Git-Tag: release/lithium-sr2~39 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=dcbc38233a9734d048d19e43bf7ccfd54fa38344;hp=d013c45cbf310d9f5129383047f18a1cbf9ac376;p=integration%2Ftest.git Deprecate REST functions in RequestsLibrary.py Robot RequestsLibary should be used instead. Change-Id: I3a55ebc6d363ff2afbfeb01276f5cf8f9ae949f7 Signed-off-by: Phillip Shea --- diff --git a/csit/libraries/RequestsLibrary.py b/csit/libraries/RequestsLibrary.py index e120972c6d..e79b4da7a5 100644 --- a/csit/libraries/RequestsLibrary.py +++ b/csit/libraries/RequestsLibrary.py @@ -1,5 +1,6 @@ import requests import json +import warnings from urllib import urlencode @@ -95,7 +96,10 @@ class RequestsLibrary(object): `headers` a dictionary of headers to use with the request """ - + warnings.warn( + "Use the Robot RequestsLibrary rather than this. See DatastoreCRUD.robot for examples", + DeprecationWarning + ) session = self._cache.switch(alias) resp = session.get(self._get_url(session, uri), headers=headers, @@ -121,6 +125,10 @@ class RequestsLibrary(object): `files` a dictionary of file names containing file data to POST to the server """ + warnings.warn( + "Use the Robot RequestsLibrary rather than this. See DatastoreCRUD.robot for examples", + DeprecationWarning + ) session = self._cache.switch(alias) data = self._utf8_urlencode(data) @@ -150,6 +158,10 @@ class RequestsLibrary(object): `files` a dictionary of file names containing file data to POST to the server """ + warnings.warn( + "Use the Robot RequestsLibrary rather than this. See DatastoreCRUD.robot for examples", + DeprecationWarning + ) session = self._cache.switch(alias) data = json.dumps(data) @@ -174,6 +186,10 @@ class RequestsLibrary(object): """ + warnings.warn( + "Use the Robot RequestsLibrary rather than this. See DatastoreCRUD.robot for examples", + DeprecationWarning + ) session = self._cache.switch(alias) # data = self._utf8_urlencode(data) data = json.dumps(data) @@ -199,6 +215,10 @@ class RequestsLibrary(object): """ + warnings.warn( + "Use the Robot RequestsLibrary rather than this. See DatastoreCRUD.robot for examples", + DeprecationWarning + ) session = self._cache.switch(alias) data = self._utf8_urlencode(data) # data = json.dumps(data) @@ -224,6 +244,10 @@ class RequestsLibrary(object): """ + warnings.warn( + "Use the Robot RequestsLibrary rather than this. See DatastoreCRUD.robot for examples", + DeprecationWarning + ) session = self._cache.switch(alias) args = "?%s" % urlencode(data) if data else '' resp = session.delete("%s%s" % (self._get_url(session, uri), args),