# TLS authentication using Python client

**URL:** <https://discuss.aerospike.com/t/tls-authentication-using-python-client/4120>\
**Category:** Python Client\
**Tags:** python\
**Created:** [May 3, 2017, 10:46am UTC](https://discuss.aerospike.com/t/tls-authentication-using-python-client/4120 "2017-05-03T10:46:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![JamieM](https://avatars.discourse-cdn.com/v4/letter/j/7cd45c/32.png) [@JamieM](https://discuss.aerospike.com/u/JamieM)\
**Post date:** [May 3, 2017, 10:46am UTC](https://discuss.aerospike.com/t/tls-authentication-using-python-client/4120/1 "2017-05-03T10:46:34Z")

</div>

I am trying to connect using the python client with TLS enabled. I can’t find any reference in the api documentation so any help would be appreciated.

From command line I can connect like this

> aql --tlsEnable --tlsCaFile cert.pem -U USER\_NAME -P -h “HOST:TLS\_HOST:PORT” -T 5000

In the python client I have this so far

```
config = {
    'hosts': [(HOST, PORT)],
    'policies': {'timeout': 1000, 'user': user, 'password': password},

}
try:
    aerospike_client = aerospike.client(config)
    aerospike_client.connect()
except Exception as e:
    print e

```

which returns

> (-1L, ‘Failed to connect’, ‘src/main/aerospike/as\_cluster.c’, 226)
