modify client
This commit is contained in:
parent
5fc9b2cccf
commit
c5add58ee9
1 changed files with 10 additions and 6 deletions
16
client.py
16
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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue