def setUp(self): pool = BlockingConnectionPool(connection_class=Connection, max_connections=2, timeout=5, host='127.0.0.1', port=8888) self.client = SSDB(connection_pool=pool) #self.client = SSDB(host='127.0.0.1', port=8888) print('set UP')
def ssdb_generator(ssdb_url, **kwargs): parsed = urlparse(ssdb_url) ssdb_config = kwargs.copy() # TODO: ssdb-py bug: socket_connect_timeout is not in __init__ # connection timeout will be equal to socket_timeout # ssdb_config['socket_connect_timeout'] = 0.1 try: if parsed.hostname and parsed.port: ssdb_config['host'] = parsed.hostname ssdb_config['port'] = parsed.port else: raise config.ConfigError("Please specify host, port in url: %s" % ssdb_url) if parsed.password: ssdb_config['auth_password'] = parsed.password except ValueError: raise config.ConfigError('Port is invalid in url: %s' % ssdb_url) return SSDB(**ssdb_config)