From f484c076d0a389ea5506e9ba89ff91a2bee6f68c Mon Sep 17 00:00:00 2001 From: Dmitry Romanenko Date: Sat, 25 May 2019 19:51:07 -0400 Subject: [PATCH] Fix POST response code API handling --- 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)