From c5add58ee98cd7da220f66728e1923a6e6cae7be Mon Sep 17 00:00:00 2001 From: mahdavi Date: Thu, 14 Nov 2019 14:55:04 +0330 Subject: [PATCH] modify client --- client.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/client.py b/client.py index 2b3becf..5225c31 100644 --- a/client.py +++ b/client.py @@ -34,7 +34,8 @@ class ApiClient(): auth_data = response.json() if 'access_token' in auth_data: self.auth_data = auth_data - return auth_data + + return auth_data def _request(self, path, data=None, files=None, method='get', with_auth=True, encode=True): if files: @@ -66,12 +67,12 @@ class ApiClient(): 'phone_number': phone_number } result = self._request(path=path, data=data, method=method, with_auth=False) - return result def get_account(self): path = 'account' - return self._request(path=path) + result = self._request(path=path) + return result def update_account(self, **kwargs): path = 'account/' @@ -97,7 +98,8 @@ class ApiClient(): files = None encode = True - return self._request(path=path, data=data, method='put', files=files, encode=encode) + result = self._request(path=path, data=data, method='put', files=files, encode=encode) + return result def change_password(self, old_password, new_password, old_password_gateway='otp'): path = 'change_password/' @@ -106,8 +108,10 @@ class ApiClient(): 'old_password_gateway': old_password_gateway } - return self._request(path=path, data=data, method='put') + result = self._request(path=path, data=data, method='put') + return result def get_user_profile(self, code): path = f'users/{code}/' - return self._request(path=path) + result = self._request(path=path) + return result