Пример #1
0
 def post(self, url, *a, **kw):
     url = join(self.base_url, url)
     kw['params'] = merge(self.default_params, kw.get('params', {}))
     kw['headers'] = merge(self.default_headers, kw.get('headers', {}))
     kw['data'] = merge(self.default_data, kw.get('data', {}))
     kw['ignore_errors'] = self.ignore_errors
     return post(url, *a, **kw)
Пример #2
0
 def __init__(self, **kw):
     config = merge(defaults, settings.like("amqp"), kw)
     required = ("port", "username", "password", "host", "vhost", "exchange", "queue")
     require(self, config, required)
     self.__dict__.update(config)
     self.config = config
     self.reconnect()
Пример #3
0
 def __init__(self, **kw):
     config = merge(defaults, settings.like("amqp"), kw)
     required = ("port", "username", "password", "host", "vhost",
                 "exchange", "queue")
     require(self, config, required)
     self.__dict__.update(config)
     self.config = config
     self.reconnect()
Пример #4
0
 def __init__(self, **kwargs):
     config = merge(defaults, settings.like('cassandra'), kwargs)
     require(self, config, ('cf_content', 'keyspace', 'servers', 'port'))
     self.__dict__.update(config)
     self.pool_size = len(self.servers) * 2
     self.pool = pycassa.ConnectionPool(
         self.keyspace,
         self.servers,
         timeout=self.timeout,
         max_retries=self.max_retries,
         pool_timeout=self.pool_timeout,
         pool_size=self.pool_size,
         recycle=self.recycle,
         prefill=self.prefill,
     )
     self.client = pycassa.ColumnFamily(self.pool, self.cf_content)
Пример #5
0
 def __init__(self, **kw):
     config = merge(defaults, settings.like("mysql"), kw)
     require(self, config, ("host", "password", "username", "database"))
     self.config = config
     self.pool = MysqlConnectionPool(config)
Пример #6
0
 def __init__(self, **kw):
     # use specialized cache if available, else default cache location
     self.config = merge(settings.like("memcached"), settings.like("header_cache"), kw)
     self.client = memcached.Memcached(**self.config)
Пример #7
0
 def post(self, url, *a, **kw):
     url = join(self.base_url, url)
     kw['params'] = merge(self.default_params, kw.get('params', {}))
     kw['headers'] = merge(self.default_headers, kw.get('headers', {}))
     return self.client.post(url, *a, **kw)
Пример #8
0
 def __init__(self, **kw):
     config = merge(defaults, settings.like("memcached"), kw)
     require(self, config, ("host", "port"))
     self.config = config
     self.pool = {}