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', '', 'False', '', config)


and Here’s the Error I received:

AttributeError at /gui/docker/
'str' object has no attribute '_auth_configs'
Request Method:	GET
Request URL:
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/ in login, line 128
Python Executable:	/Users/abdul/IstioVirEnv/bin/python
Python Version:	3.6.1