4
4
5
5
All the library exposed functionality
6
6
"""
7
- import warnings
8
- from inspect import getargspec
7
+ import logging
8
+ from inspect import getfullargspec
9
9
10
10
from .clients .rest_rfx import RestClient
11
11
from .clients .websocket_rfx import WebSocketClient
@@ -535,7 +535,7 @@ def init_websocket_connection(market_data_handler=None,
535
535
# Gets the client for the environment
536
536
client = globals .environment_config [environment ]["ws_client" ]
537
537
538
- # Checks handlers and adds the them into the client.
538
+ # Checks handlers and adds them into the client.
539
539
if market_data_handler is not None :
540
540
_validate_handler (market_data_handler )
541
541
client .add_market_data_handler (market_data_handler )
@@ -549,7 +549,7 @@ def init_websocket_connection(market_data_handler=None,
549
549
client .add_error_handler (error_handler )
550
550
551
551
if exception_handler is not None :
552
- _validate_handler (error_handler )
552
+ _validate_handler (exception_handler )
553
553
client .set_exception_handler (exception_handler )
554
554
555
555
# Initiates the connection with the Websocket API
@@ -964,9 +964,9 @@ def _validate_handler(handler):
964
964
raise ApiException ("Handler '{handler}' is not callable." .format (handler = handler ))
965
965
966
966
# Checks if function can receive an argument
967
- fun_arg_spec = getargspec (handler )
967
+ fun_arg_spec = getfullargspec (handler )
968
968
if not fun_arg_spec .args and not fun_arg_spec .varargs :
969
- print ("Handler '{handler}' can't receive an argument." .format (handler = handler ))
969
+ logging . error ("Handler '{handler}' can't receive an argument." .format (handler = handler ))
970
970
971
971
972
972
def _validate_market_data_entries (entries ):
@@ -984,6 +984,6 @@ def _validate_market_data_entries(entries):
984
984
else :
985
985
for entry in entries :
986
986
if not isinstance (entry , MarketDataEntry ):
987
- print ("WARNING: Market Data Entry not defined: " + str (entry ))
987
+ logging . warn ("WARNING: Market Data Entry not defined: " + str (entry ))
988
988
989
989
return entries
0 commit comments