@@ -54,7 +54,8 @@ def get(self, endpoint, params=None):
5454
5555 :param endpoint: the server endpoint to use for the GET request
5656 :param params: the parameters that pertain to the request (optional)
57- :returns: a JSON object containing the API response
57+ :returns: a dictionary containing the API response status code as well as the decoded JSON response if decoding
58+ was successful. If not, the response text is returned.
5859 """
5960 response = self .session .get (
6061 self .url + endpoint ,
@@ -85,6 +86,7 @@ def get(self, endpoint, params=None):
8586 }
8687 except ValueError :
8788 return {
89+ "data" : response .text ,
8890 "status" : response .status_code
8991 }
9092
@@ -94,7 +96,8 @@ def post(self, endpoint, body=None, params=None):
9496 :param endpoint: the server endpoint to use for the POST request
9597 :param body: the body of the request (optional)
9698 :param params: the parameters that pertain to the request (optional)
97- :returns: a JSON object containing the API response
99+ :returns: a dictionary containing the API response status code as well as the decoded JSON response if decoding
100+ was successful. If not, the response text is returned.
98101 """
99102 response = self .session .post (
100103 self .url + endpoint ,
@@ -128,6 +131,7 @@ def post(self, endpoint, body=None, params=None):
128131 }
129132 except ValueError :
130133 return {
134+ "data" : response .text ,
131135 "status" : response .status_code
132136 }
133137
@@ -137,7 +141,8 @@ def put(self, endpoint, body=None, params=None):
137141 :param endpoint: the server endpoint to use for the PUT request
138142 :param body: the body of the request (optional)
139143 :param params: the parameters that pertain to the request (optional)
140- :returns: a JSON object containing the response code and the API response if
144+ :returns: a dictionary containing the API response status code as well as the decoded JSON response if decoding
145+ was successful. If not, the response text is returned.
141146 """
142147 response = self .session .put (
143148 self .url + endpoint ,
@@ -171,6 +176,7 @@ def put(self, endpoint, body=None, params=None):
171176 }
172177 except ValueError :
173178 return {
179+ "data" : response .text ,
174180 "status" : response .status_code
175181 }
176182
@@ -179,7 +185,8 @@ def delete(self, endpoint, params=None):
179185
180186 :param endpoint: the server endpoint to use for the DELETE request
181187 :param params: the parameters that pertain to the request (optional)
182- :returns: a JSON object containing the API response
188+ :returns: a dictionary containing the API response status code as well as the decoded JSON response if decoding
189+ was successful. If not, the response text is returned.
183190 """
184191 response = self .session .delete (
185192 self .url + endpoint ,
@@ -212,6 +219,7 @@ def delete(self, endpoint, params=None):
212219 }
213220 except ValueError :
214221 return {
222+ "data" : response .text ,
215223 "status" : response .status_code
216224 }
217225
0 commit comments