python __dict__
class BaseResponse:
def __init__(self):
self.status = True
self.error = 'error_msg'
self.data = 'detail_data'
@property
def dict(self):
return self.__dict__
obj=BaseResponse()
print(obj.dict) #{'status': True, 'error': 'error_msg', 'data': 'detail_data'}
print(obj.__dict__) # {'status': True, 'error': 'error_msg', 'data': 'detail_data'}