From c31fcd8ac5a2c59dd88879288676016ffeea9a4f Mon Sep 17 00:00:00 2001 From: Dmitry Romanenko Date: Wed, 29 May 2019 17:42:52 -0400 Subject: [PATCH] Fix POST response code API handling (#32) POST api is responding with response code 202 instead of 200 https://hadoop.apache.org/docs/r2.7.3/hadoop-yarn/hadoop-yarn-site/ResourceManagerRest.html#Cluster_New_Application_API --- yarn_api_client/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yarn_api_client/base.py b/yarn_api_client/base.py index 92425fb..9e248b9 100644 --- a/yarn_api_client/base.py +++ b/yarn_api_client/base.py @@ -44,7 +44,7 @@ def request(self, api_path, method='GET', **kwargs): else: response = requests.request(method=method, url=api_endpoint, headers=headers, **kwargs) - if response.status_code == requests.codes.ok: + if response.status_code in (200, 202): return self.response_class(response) else: msg = 'Response finished with status: %s. Details: %s' % (response.status_code, response.text)