couchbase/couchbase-python-client — pull request #15 by kvogt (2012-12-18 19:54:42+00:00)
Title: Fix TypeError caused by incompatibility with requests 1.0.3

fix error: TypeError: 'instancemethod' object is not subscriptable, due to not calling .json() on requests Response object:

What happens:

>>> from couchbase.client import Couchbase
>>> couchbase = Couchbase("127.0.0.1:8091", "default", "")
Traceback (most recent call last):
File "", line 1, in
File "/Library/Python/2.7/site-packages/couchbase/client.py", line 61, in __init__
self.couch_api_base = config["nodes"][0].get("couchApiBase")
TypeError: 'instancemethod' object is not subscriptable

Because .json is a function and must be called:

>>> import requests
>>> requests.__version__
'1.0.3'
>>> ip = '127.0.0.1'
>>> port = 8091
>>> server_config_uri = "http://%s:%s/pools/default" % (ip, port)
>>> config = requests.get(server_config_uri)
>>> config

>>> config.json
>
>>> config.json()
{u'rebalanceProgressUri': u'/poo.....