Not able to connect to cloudant DB from python code

Hi There,

I am not able to connect to Cloudant DB which I created in Watson IoT platform.

I am running the below code to connect to cloudant DB from python which I referred from [here][1]:

from cloudant.client import Cloudant

serviceUsername = “3e80881e-8b4f-4a92-8aed-bfcd1c7536af-bluemix”
servicePassword = “49c0c343d225623956157d94b25d574586f26d1211e8e589646b4713d5de4801”
serviceURL = “”

client = Cloudant(serviceUsername, servicePassword, url=serviceURL)
databaseName = “databasedemo”
myDatabaseDemo = client.create_database(databaseName)

But I am getting the below error on the line client.connect() :

requests.exceptions.ConnectionError: HTTPSConnectionPool(host=’’, port=443): Max retries exceeded with url: /_session (Caused by NewConnectionError(‘: Failed to establish a new connection: [Errno -2] Name or service not known’,))

and some times the line client.connect() executes but fail on further operation and when I print the ‘client’ then I get ‘{}’ means connection is not getting created.

I don’t know how to make use of ‘VCAP SERVICES’ and even I don’t like to go with that way.

Please help me out I am stuck here.
Thanks in advance.



Leave a Reply