in uamqp/connection.py [0:0]
def __init__(self, hostname, sasl,
container_id=False,
max_frame_size=None,
channel_max=None,
idle_timeout=None,
properties=None,
remote_idle_timeout_empty_frame_send_ratio=None,
error_policy=None,
debug=False,
encoding='UTF-8'):
uamqp._Platform.initialize() # pylint: disable=protected-access
self.container_id = container_id if container_id else str(uuid.uuid4())
if isinstance(self.container_id, str):
self.container_id = self.container_id.encode(encoding)
self.hostname = hostname.encode(encoding) if isinstance(hostname, str) else hostname
self.auth = sasl
self._cbs = None
self.error_policy = error_policy or errors.ErrorPolicy()
self._debug = debug
self._conn = self._create_connection(sasl)
self._sessions = []
self._lock = threading.Lock()
self._state = c_uamqp.ConnectionState.UNKNOWN
self._encoding = encoding
self._settings = {}
self._error = None
self._closing = False
if max_frame_size:
self._settings['max_frame_size'] = max_frame_size
self.max_frame_size = max_frame_size
if channel_max:
self._settings['channel_max'] = channel_max
self.channel_max = channel_max
if idle_timeout:
self._settings['idle_timeout'] = idle_timeout
self.idle_timeout = idle_timeout
if properties:
self._settings['properties'] = properties
self.properties = properties
if remote_idle_timeout_empty_frame_send_ratio:
self._conn.remote_idle_timeout_empty_frame_send_ratio = remote_idle_timeout_empty_frame_send_ratio