Docker Login to python Client of Docker API

I’m trying to accomplish docker login through docker api python client but not successfully login,
I’m confused and read the documentation but couldn’t get any solution.

Here’s what I have done:

My python code:

 import docker

config = os.path.join(BASE_DIR, 'IGui') + 'config.json'

client = docker.APIClient.login( 'arycloud', 'Abd37214@cloud', 'arycloud7@gmail.com', 'False', 'https://index.docker.io/v1/', config)

print(client)

and Here’s the Error I received:

AttributeError at /gui/docker/
'str' object has no attribute '_auth_configs'
Request Method:	GET
Request URL:	http://127.0.0.1:8000/gui/docker/
Django Version:	1.11.3
Exception Type:	AttributeError
Exception Value:	
'str' object has no attribute '_auth_configs'
Exception Location:	/Users/abdul/IstioVirEnv/lib/python3.6/site-packages/docker/api/daemon.py in login, line 128
Python Executable:	/Users/abdul/IstioVirEnv/bin/python
Python Version:	3.6.1