1 __author__ = "Basheeruddin Ahmed"
2 __copyright__ = "Copyright(c) 2014, Cisco Systems, Inc."
3 __license__ = "New-style BSD"
4 __email__ = "syedbahm@cisco.com"
10 def get(url, userId, password):
11 """Helps in making GET REST calls"""
13 headers['Accept'] = 'application/xml'
15 # Send the GET request
16 req = requests.get(url, None, headers)
22 def nonprintpost(url, userId, password, data):
23 """Helps in making POST REST calls without outputs"""
25 headers['Content-Type'] = 'application/json'
26 # headers['Accept']= 'application/xml'
28 resp = requests.post(url, data.encode(), headers=headers)
33 def post(url, userId, password, data):
34 """Helps in making POST REST calls"""
35 print("post request with url " + url)
36 print("post request with data " + data)
38 headers['Content-Type'] = 'application/json'
39 # headers['Accept']= 'application/xml'
41 resp = requests.post(url, data.encode(), headers=headers)
43 # print (resp.raise_for_status())
49 def delete(url, userId, password):
50 """Helps in making DELET REST calls"""
51 print("delete all resources belonging to url" + url)
52 resp = requests.delete(url) # noqa