diff --git a/seatable_api/main.py b/seatable_api/main.py index fffe0dd..321bc86 100644 --- a/seatable_api/main.py +++ b/seatable_api/main.py @@ -761,6 +761,12 @@ def query(self, sql, src='all'): raise Exception(data.get('error_message')) return data.get('results') + def close(self): + if self.socketIO: + self.socketIO._dis_connect() + return {'is_closed': True} + raise Exception('close invalid') + class Account(object): def __init__(self, login_name, password, server_url): diff --git a/seatable_api/socket_io.py b/seatable_api/socket_io.py index 45ddbfc..9c396c0 100644 --- a/seatable_api/socket_io.py +++ b/seatable_api/socket_io.py @@ -25,6 +25,9 @@ def _connect(self): self.sio.connect(self.dtable_ws_url) + def _dis_connect(self): + self.sio.disconnect() + def _refresh_jwt_token(self): self.base.auth() print(datetime.now(), '[ SeaTable SocketIO JWT token refreshed ]')