def __init__(self, addr, **kwargs): self._addr = addr self._requests = [] self.__batch = kwargs.get('batch', None) self._key = kwargs.get('key', None) if self._key and not config.crypt: raise EncryptionMissing('No encryption library found.')
def __init__(self, addr, handler=None, pool=10): if config.secret and not config.crypt: raise EncryptionMissing('No encrpytion library found.') self.addr = addr self.socket = None self.threads = [] # Pool not actually implemented yet self.pool = pool self.json_request = JSONRequest(self) if handler: assert hasattr(handler, '__call__') or \ issubclass(handler, Handler) self.json_request.add_handler(handler)