We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN 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).

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `docker/api/daemon.py`
Content:
```
1 import os
2 from datetime import datetime
3 
4 from .. import auth, utils
5 
6 
7 class DaemonApiMixin(object):
8     @utils.minimum_version('1.25')
9     def df(self):
10         """
11         Get data usage information.
12 
13         Returns:
14             (dict): A dictionary representing different resource categories
15             and their respective data usage.
16 
17         Raises:
18             :py:class:`docker.errors.APIError`
19                 If the server returns an error.
20         """
21         url = self._url('/system/df')
22         return self._result(self._get(url), True)
23 
24     def events(self, since=None, until=None, filters=None, decode=None):
25         """
26         Get real-time events from the server. Similar to the ``docker events``
27         command.
28 
29         Args:
30             since (UTC datetime or int): Get events from this point
31             until (UTC datetime or int): Get events until this point
32             filters (dict): Filter the events by event time, container or image
33             decode (bool): If set to true, stream will be decoded into dicts on
34                 the fly. False by default.
35 
36         Returns:
37             (generator): A blocking generator you can iterate over to retrieve
38                 events as they happen.
39 
40         Raises:
41             :py:class:`docker.errors.APIError`
42                 If the server returns an error.
43 
44         Example:
45 
46             >>> for event in client.events()
47             ...   print event
48             {u'from': u'image/with:tag',
49              u'id': u'container-id',
50              u'status': u'start',
51              u'time': 1423339459}
52             ...
53         """
54 
55         if isinstance(since, datetime):
56             since = utils.datetime_to_timestamp(since)
57 
58         if isinstance(until, datetime):
59             until = utils.datetime_to_timestamp(until)
60 
61         if filters:
62             filters = utils.convert_filters(filters)
63 
64         params = {
65             'since': since,
66             'until': until,
67             'filters': filters
68         }
69         url = self._url('/events')
70 
71         return self._stream_helper(
72             self._get(url, params=params, stream=True, timeout=None),
73             decode=decode
74         )
75 
76     def info(self):
77         """
78         Display system-wide information. Identical to the ``docker info``
79         command.
80 
81         Returns:
82             (dict): The info as a dict
83 
84         Raises:
85             :py:class:`docker.errors.APIError`
86                 If the server returns an error.
87         """
88         return self._result(self._get(self._url("/info")), True)
89 
90     def login(self, username, password=None, email=None, registry=None,
91               reauth=False, dockercfg_path=None):
92         """
93         Authenticate with a registry. Similar to the ``docker login`` command.
94 
95         Args:
96             username (str): The registry username
97             password (str): The plaintext password
98             email (str): The email for the registry account
99             registry (str): URL to the registry.  E.g.
100                 ``https://index.docker.io/v1/``
101             reauth (bool): Whether or not to refresh existing authentication on
102                 the Docker server.
103             dockercfg_path (str): Use a custom path for the Docker config file
104                 (default ``$HOME/.docker/config.json`` if present,
105                 otherwise``$HOME/.dockercfg``)
106 
107         Returns:
108             (dict): The response from the login request
109 
110         Raises:
111             :py:class:`docker.errors.APIError`
112                 If the server returns an error.
113         """
114 
115         # If we don't have any auth data so far, try reloading the config file
116         # one more time in case anything showed up in there.
117         # If dockercfg_path is passed check to see if the config file exists,
118         # if so load that config.
119         if dockercfg_path and os.path.exists(dockercfg_path):
120             self._auth_configs = auth.load_config(dockercfg_path)
121         elif not self._auth_configs:
122             self._auth_configs = auth.load_config()
123 
124         authcfg = auth.resolve_authconfig(self._auth_configs, registry)
125         # If we found an existing auth config for this registry and username
126         # combination, we can return it immediately unless reauth is requested.
127         if authcfg and authcfg.get('username', None) == username \
128                 and not reauth:
129             return authcfg
130 
131         req_data = {
132             'username': username,
133             'password': password,
134             'email': email,
135             'serveraddress': registry,
136         }
137 
138         response = self._post_json(self._url('/auth'), data=req_data)
139         if response.status_code == 200:
140             if 'auths' not in self._auth_configs:
141                 self._auth_configs['auths'] = {}
142             self._auth_configs[registry or auth.INDEX_NAME] = req_data
143         return self._result(response, json=True)
144 
145     def ping(self):
146         """
147         Checks the server is responsive. An exception will be raised if it
148         isn't responding.
149 
150         Returns:
151             (bool) The response from the server.
152 
153         Raises:
154             :py:class:`docker.errors.APIError`
155                 If the server returns an error.
156         """
157         return self._result(self._get(self._url('/_ping'))) == 'OK'
158 
159     def version(self, api_version=True):
160         """
161         Returns version information from the server. Similar to the ``docker
162         version`` command.
163 
164         Returns:
165             (dict): The server version information
166 
167         Raises:
168             :py:class:`docker.errors.APIError`
169                 If the server returns an error.
170         """
171         url = self._url("/version", versioned_api=api_version)
172         return self._result(self._get(url), json=True)
173
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

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 @@
         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):

{"golden_diff": "diff --git a/docker/api/daemon.py b/docker/api/daemon.py\n--- a/docker/api/daemon.py\n+++ b/docker/api/daemon.py\n@@ -139,7 +139,7 @@\n         if response.status_code == 200:\n             if 'auths' not in self._auth_configs:\n                 self._auth_configs['auths'] = {}\n-            self._auth_configs[registry or auth.INDEX_NAME] = req_data\n+            self._auth_configs['auths'][registry or auth.INDEX_NAME] = req_data\n         return self._result(response, json=True)\n \n     def ping(self):\n", "issue": "Downloading no longer works?\nSo something seems to have changed and/or broken in 3.0 since we are now seeing the following:\r\n\r\n```\r\nusing docker==3.0\r\n\r\nDEBUG: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\r\nu'{\"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'\r\n\r\nusing docker==2.7.0\r\n\r\n>>> 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\")\r\nDEBUG:docker.auth:Looking for auth config\r\nDEBUG:docker.auth:Looking for auth entry for 'docker-cloud-ostack-local.artifactory.secureserver.net'\r\nDEBUG:docker.auth:Found 'docker-cloud-ostack-local.artifactory.secureserver.net'\r\nDEBUG:docker.auth:Found auth config\r\nDEBUG:urllib3.connectionpool:Resetting dropped connection: localhost\r\nDEBUG: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\r\n\r\ndownloads fine in 2.7.0 :-/\r\n```\r\n\r\nAny ideas; perhaps a bug? The only diff seems to be `v1.30` vs `v1.35`\r\n\r\nThis is against `docker-engine-17.05.0.ce-1.el7.centos.x86_64`  (if that matters).\n", "before_files": [{"content": "import os\nfrom datetime import datetime\n\nfrom .. import auth, utils\n\n\nclass DaemonApiMixin(object):\n    @utils.minimum_version('1.25')\n    def df(self):\n        \"\"\"\n        Get data usage information.\n\n        Returns:\n            (dict): A dictionary representing different resource categories\n            and their respective data usage.\n\n        Raises:\n            :py:class:`docker.errors.APIError`\n                If the server returns an error.\n        \"\"\"\n        url = self._url('/system/df')\n        return self._result(self._get(url), True)\n\n    def events(self, since=None, until=None, filters=None, decode=None):\n        \"\"\"\n        Get real-time events from the server. Similar to the ``docker events``\n        command.\n\n        Args:\n            since (UTC datetime or int): Get events from this point\n            until (UTC datetime or int): Get events until this point\n            filters (dict): Filter the events by event time, container or image\n            decode (bool): If set to true, stream will be decoded into dicts on\n                the fly. False by default.\n\n        Returns:\n            (generator): A blocking generator you can iterate over to retrieve\n                events as they happen.\n\n        Raises:\n            :py:class:`docker.errors.APIError`\n                If the server returns an error.\n\n        Example:\n\n            >>> for event in client.events()\n            ...   print event\n            {u'from': u'image/with:tag',\n             u'id': u'container-id',\n             u'status': u'start',\n             u'time': 1423339459}\n            ...\n        \"\"\"\n\n        if isinstance(since, datetime):\n            since = utils.datetime_to_timestamp(since)\n\n        if isinstance(until, datetime):\n            until = utils.datetime_to_timestamp(until)\n\n        if filters:\n            filters = utils.convert_filters(filters)\n\n        params = {\n            'since': since,\n            'until': until,\n            'filters': filters\n        }\n        url = self._url('/events')\n\n        return self._stream_helper(\n            self._get(url, params=params, stream=True, timeout=None),\n            decode=decode\n        )\n\n    def info(self):\n        \"\"\"\n        Display system-wide information. Identical to the ``docker info``\n        command.\n\n        Returns:\n            (dict): The info as a dict\n\n        Raises:\n            :py:class:`docker.errors.APIError`\n                If the server returns an error.\n        \"\"\"\n        return self._result(self._get(self._url(\"/info\")), True)\n\n    def login(self, username, password=None, email=None, registry=None,\n              reauth=False, dockercfg_path=None):\n        \"\"\"\n        Authenticate with a registry. Similar to the ``docker login`` command.\n\n        Args:\n            username (str): The registry username\n            password (str): The plaintext password\n            email (str): The email for the registry account\n            registry (str): URL to the registry.  E.g.\n                ``https://index.docker.io/v1/``\n            reauth (bool): Whether or not to refresh existing authentication on\n                the Docker server.\n            dockercfg_path (str): Use a custom path for the Docker config file\n                (default ``$HOME/.docker/config.json`` if present,\n                otherwise``$HOME/.dockercfg``)\n\n        Returns:\n            (dict): The response from the login request\n\n        Raises:\n            :py:class:`docker.errors.APIError`\n                If the server returns an error.\n        \"\"\"\n\n        # If we don't have any auth data so far, try reloading the config file\n        # one more time in case anything showed up in there.\n        # If dockercfg_path is passed check to see if the config file exists,\n        # if so load that config.\n        if dockercfg_path and os.path.exists(dockercfg_path):\n            self._auth_configs = auth.load_config(dockercfg_path)\n        elif not self._auth_configs:\n            self._auth_configs = auth.load_config()\n\n        authcfg = auth.resolve_authconfig(self._auth_configs, registry)\n        # If we found an existing auth config for this registry and username\n        # combination, we can return it immediately unless reauth is requested.\n        if authcfg and authcfg.get('username', None) == username \\\n                and not reauth:\n            return authcfg\n\n        req_data = {\n            'username': username,\n            'password': password,\n            'email': email,\n            'serveraddress': registry,\n        }\n\n        response = self._post_json(self._url('/auth'), data=req_data)\n        if response.status_code == 200:\n            if 'auths' not in self._auth_configs:\n                self._auth_configs['auths'] = {}\n            self._auth_configs[registry or auth.INDEX_NAME] = req_data\n        return self._result(response, json=True)\n\n    def ping(self):\n        \"\"\"\n        Checks the server is responsive. An exception will be raised if it\n        isn't responding.\n\n        Returns:\n            (bool) The response from the server.\n\n        Raises:\n            :py:class:`docker.errors.APIError`\n                If the server returns an error.\n        \"\"\"\n        return self._result(self._get(self._url('/_ping'))) == 'OK'\n\n    def version(self, api_version=True):\n        \"\"\"\n        Returns version information from the server. Similar to the ``docker\n        version`` command.\n\n        Returns:\n            (dict): The server version information\n\n        Raises:\n            :py:class:`docker.errors.APIError`\n                If the server returns an error.\n        \"\"\"\n        url = self._url(\"/version\", versioned_api=api_version)\n        return self._result(self._get(url), json=True)\n", "path": "docker/api/daemon.py"}], "after_files": [{"content": "import os\nfrom datetime import datetime\n\nfrom .. import auth, utils\n\n\nclass DaemonApiMixin(object):\n    @utils.minimum_version('1.25')\n    def df(self):\n        \"\"\"\n        Get data usage information.\n\n        Returns:\n            (dict): A dictionary representing different resource categories\n            and their respective data usage.\n\n        Raises:\n            :py:class:`docker.errors.APIError`\n                If the server returns an error.\n        \"\"\"\n        url = self._url('/system/df')\n        return self._result(self._get(url), True)\n\n    def events(self, since=None, until=None, filters=None, decode=None):\n        \"\"\"\n        Get real-time events from the server. Similar to the ``docker events``\n        command.\n\n        Args:\n            since (UTC datetime or int): Get events from this point\n            until (UTC datetime or int): Get events until this point\n            filters (dict): Filter the events by event time, container or image\n            decode (bool): If set to true, stream will be decoded into dicts on\n                the fly. False by default.\n\n        Returns:\n            (generator): A blocking generator you can iterate over to retrieve\n                events as they happen.\n\n        Raises:\n            :py:class:`docker.errors.APIError`\n                If the server returns an error.\n\n        Example:\n\n            >>> for event in client.events()\n            ...   print event\n            {u'from': u'image/with:tag',\n             u'id': u'container-id',\n             u'status': u'start',\n             u'time': 1423339459}\n            ...\n        \"\"\"\n\n        if isinstance(since, datetime):\n            since = utils.datetime_to_timestamp(since)\n\n        if isinstance(until, datetime):\n            until = utils.datetime_to_timestamp(until)\n\n        if filters:\n            filters = utils.convert_filters(filters)\n\n        params = {\n            'since': since,\n            'until': until,\n            'filters': filters\n        }\n        url = self._url('/events')\n\n        return self._stream_helper(\n            self._get(url, params=params, stream=True, timeout=None),\n            decode=decode\n        )\n\n    def info(self):\n        \"\"\"\n        Display system-wide information. Identical to the ``docker info``\n        command.\n\n        Returns:\n            (dict): The info as a dict\n\n        Raises:\n            :py:class:`docker.errors.APIError`\n                If the server returns an error.\n        \"\"\"\n        return self._result(self._get(self._url(\"/info\")), True)\n\n    def login(self, username, password=None, email=None, registry=None,\n              reauth=False, dockercfg_path=None):\n        \"\"\"\n        Authenticate with a registry. Similar to the ``docker login`` command.\n\n        Args:\n            username (str): The registry username\n            password (str): The plaintext password\n            email (str): The email for the registry account\n            registry (str): URL to the registry.  E.g.\n                ``https://index.docker.io/v1/``\n            reauth (bool): Whether or not to refresh existing authentication on\n                the Docker server.\n            dockercfg_path (str): Use a custom path for the Docker config file\n                (default ``$HOME/.docker/config.json`` if present,\n                otherwise``$HOME/.dockercfg``)\n\n        Returns:\n            (dict): The response from the login request\n\n        Raises:\n            :py:class:`docker.errors.APIError`\n                If the server returns an error.\n        \"\"\"\n\n        # If we don't have any auth data so far, try reloading the config file\n        # one more time in case anything showed up in there.\n        # If dockercfg_path is passed check to see if the config file exists,\n        # if so load that config.\n        if dockercfg_path and os.path.exists(dockercfg_path):\n            self._auth_configs = auth.load_config(dockercfg_path)\n        elif not self._auth_configs:\n            self._auth_configs = auth.load_config()\n\n        authcfg = auth.resolve_authconfig(self._auth_configs, registry)\n        # If we found an existing auth config for this registry and username\n        # combination, we can return it immediately unless reauth is requested.\n        if authcfg and authcfg.get('username', None) == username \\\n                and not reauth:\n            return authcfg\n\n        req_data = {\n            'username': username,\n            'password': password,\n            'email': email,\n            'serveraddress': registry,\n        }\n\n        response = self._post_json(self._url('/auth'), data=req_data)\n        if response.status_code == 200:\n            if 'auths' not in self._auth_configs:\n                self._auth_configs['auths'] = {}\n            self._auth_configs['auths'][registry or auth.INDEX_NAME] = req_data\n        return self._result(response, json=True)\n\n    def ping(self):\n        \"\"\"\n        Checks the server is responsive. An exception will be raised if it\n        isn't responding.\n\n        Returns:\n            (bool) The response from the server.\n\n        Raises:\n            :py:class:`docker.errors.APIError`\n                If the server returns an error.\n        \"\"\"\n        return self._result(self._get(self._url('/_ping'))) == 'OK'\n\n    def version(self, api_version=True):\n        \"\"\"\n        Returns version information from the server. Similar to the ``docker\n        version`` command.\n\n        Returns:\n            (dict): The server version information\n\n        Raises:\n            :py:class:`docker.errors.APIError`\n                If the server returns an error.\n        \"\"\"\n        url = self._url(\"/version\", versioned_api=api_version)\n        return self._result(self._get(url), json=True)\n", "path": "docker/api/daemon.py"}]}