iamlistening.main.Listener#
- class iamlistening.main.Listener[source]#
Bases:
object
Listener Class for IAmListening.
This class provides methods for starting and stopping the listener for each platform.
Initializes the class instance by creating and appending clients based on the configuration in settings.platform.
Checks if the module is enabled by looking at settings.iamlistening_enabled. If the module is disabled, no clients will be created.
Creates a mapping of library names to client classes. This mapping is used to create new clients based on the configuration.
If a client’s configuration exists in settings.platform and its “enabled” key is truthy, it will be created. Clients are not created if their name is “template” or empty string.
If a client is successfully created, it is appended to the clients list.
If a client fails to be created, a message is logged with the name of the client and the error that occurred.
- Parameters:
None
- Returns:
None
Methods
Retrieves all client classes from the iamlistening.protocol module.
get_info
()Retrieves information about the exchange and the account.
start
()Asynchronously start the listener.
stop
()Stop the listener.
- get_all_client_classes()[source]#
Retrieves all client classes from the iamlistening.protocol module.
This function imports the iamlistening.protocol module and retrieves all the classes defined in it.
The function returns a dictionary where the keys are the names of the classes and the values are the corresponding class objects.
- Returns:
A dictionary containing all the client classes from the iamlistening.protocol module.
- Return type:
dict
- async get_info()[source]#
Retrieves information about the exchange and the account.
- Returns:
A formatted string containing
the exchange name and the account information. :rtype: str