48 self.custom_websocket_url = custom_ws_url
49
50 def kill_connection(self):
51 """ 52 Method that force kills the WebSocket connection by sending a SIGINT signal.
53 """
54 self.is_connected = False
55 kill(getpid(), SIGINT)
56
57 def setup(self):
58 """ 59 Method that sets up the WebSocket connection and registers event handlers.
60 """
61 user_agent = f"{self.metadata.user_id} API Bot | Python Library"
101 )
102
103 def identify(self):
104 """105 Method that sends an "identify" frame to the server to authenticate the user.
106 """
107 if self.is_authed is False:
109 self.send("identify", self.auth, namespace="/trade")
110
111 def emit_filters(self):
112 """113 Method that sends a default filter frame to ensure that the client receives all events.
114 """
115 options = {
160 self.sio.disconnect()
161
162 def disconnect(self):
163 """164 Method that disconnects the socket and updates the has_disconnected flag.
165 """
166 self.has_disconnected = True
If a docstring fits in a single line (72 characters according to PEP8), it is recommended to have the quotes on the same line.
def foo():
"""
Runs bar and returns baz.
"""
baz = bar()
return baz
def foo():
"""Runs bar and returns baz."""
baz = bar()
return baz