Repository: docker/docker-py

Issue:
Downloading no longer works?
So something seems to have changed and/or broken in 3.0 since we are now seeing the following:

```
using docker==3.0

DEBUG:urllib3.connectionpool:http://localhost:None "POST /v1.35/images/create?tag=glance.15.0.1.g06af2eb5abe0.j27&fromImage=docker-cloud-ostack-local.artifactory.secureserver.net%2Fcentos-source-glance-api%3Aglance.15.0.1.g06af2eb5abe0.j27 HTTP/1.1" 200 None
u'{"status":"Pulling repository docker-cloud-ostack-local.artifactory.secureserver.net/centos-source-glance-api"}\r\n{"errorDetail":{"message":"Error: image centos-source-glance-api:glance.15.0.1.g06af2eb5abe0.j27 not found"},"error":"Error: image centos-source-glance-api:glance.15.0.1.g06af2eb5abe0.j27 not found"}\r\n'

using docker==2.7.0

>>> dc.pull(repository="docker-cloud-ostack-local.artifactory.secureserver.net/centos-source-glance-api:glance.15.0.1.g06af2eb5abe0.j27", tag="glance.15.0.1.g06af2eb5abe0.j27")
DEBUG:docker.auth:Looking for auth config
DEBUG:docker.auth:Looking for auth entry for 'docker-cloud-ostack-local.artifactory.secureserver.net'
DEBUG:docker.auth:Found 'docker-cloud-ostack-local.artifactory.secureserver.net'
DEBUG:docker.auth:Found auth config
DEBUG:urllib3.connectionpool:Resetting dropped connection: localhost
DEBUG:urllib3.connectionpool:http://localhost:None "POST /v1.30/images/create?tag=glance.15.0.1.g06af2eb5abe0.j27&fromImage=docker-cloud-ostack-local.artifactory.secureserver.net%2Fcentos-source-glance-api%3Aglance.15.0.1.g06af2eb5abe0.j27 HTTP/1.1" 200 None

downloads fine in 2.7.0 :-/
```

Any ideas; perhaps a bug? The only diff seems to be `v1.30` vs `v1.35`

This is against `docker-engine-17.05.0.ce-1.el7.centos.x86_64`  (if that matters).


Discussion:
I might have messed up some of the auth stuff - I'll look into it asap and keep you posted. Thanks for the report!
@harlowja Are you using the `login()` method to authenticate? 

Resolving patch:
diff --git a/docker/api/daemon.py b/docker/api/daemon.py
--- a/docker/api/daemon.py
+++ b/docker/api/daemon.py
@@ -139,7 +139,7 @@ def login(self, username, password=None, email=None, registry=None,
         if response.status_code == 200:
             if 'auths' not in self._auth_configs:
                 self._auth_configs['auths'] = {}
-            self._auth_configs[registry or auth.INDEX_NAME] = req_data
+            self._auth_configs['auths'][registry or auth.INDEX_NAME] = req_data
         return self._result(response, json=True)
 
     def ping(self):


Test patch:
diff --git a/tests/unit/api_test.py b/tests/unit/api_test.py
--- a/tests/unit/api_test.py
+++ b/tests/unit/api_test.py
@@ -212,6 +212,24 @@ def test_search(self):
             timeout=DEFAULT_TIMEOUT_SECONDS
         )
 
+    def test_login(self):
+        self.client.login('sakuya', 'izayoi')
+        fake_request.assert_called_with(
+            'POST', url_prefix + 'auth',
+            data=json.dumps({'username': 'sakuya', 'password': 'izayoi'}),
+            timeout=DEFAULT_TIMEOUT_SECONDS,
+            headers={'Content-Type': 'application/json'}
+        )
+
+        assert self.client._auth_configs['auths'] == {
+            'docker.io': {
+                'email': None,
+                'password': 'izayoi',
+                'username': 'sakuya',
+                'serveraddress': None,
+            }
+        }
+
     def test_events(self):
         self.client.events()