Repository: docker/docker-py

Issue:
DockerClient.images.pull() has inconsistent parameter naming
The [documentation](https://docker-py.readthedocs.io/en/stable/images.html) for Images::pull states the usage as: pull(name, **kwargs). However, its Parameters description does not have 'name' but just has 'repository' (which used to work with the older low-level api client)

Looking at the code, the docker-py/docker/models/images.py has the function declared as:
def pull(self, name, **kwargs) and passes name, kwargs to the docker-py/docker/api/image.py:: ImageApiMixin::pull whose parameter is named repository (and not name).

The consequence is:
**client.images.pull(repository=<repository_details>)** fails with TypeError: pull() takes exactly 2 arguments (1 given) since it expects name though as per the documentation, repository should work. 

client.images.pull(name=<name>, repository=<repo_details>) fails with TypeError: pull() got multiple values for keyword argument 'repository' as the name parameter was passed in to the next method which interprets it as repository. 

client.images.pull('image_name') - works - and works for a name that has registry / tag in it. 

Given that under the wraps, we are accepting a repository format for this API, Can we just rename the only mandatory parameter as repository (from current 'name'). This would be consistent with the older behavior and to be consistent with the push api - and more in line with the actual default behavior when no parameter name is specified. 






Discussion:
Thanks for the report - we'll look into it and figure out the best way to approach a fix.
@swagh1983 how does it work for registry and tag in it? whats the format?

Resolving patch:
diff --git a/docker/models/images.py b/docker/models/images.py
--- a/docker/models/images.py
+++ b/docker/models/images.py
@@ -266,7 +266,7 @@ def load(self, data):
 
         return [self.get(i) for i in images]
 
-    def pull(self, name, tag=None, **kwargs):
+    def pull(self, repository, tag=None, **kwargs):
         """
         Pull an image of the given name and return it. Similar to the
         ``docker pull`` command.
@@ -280,7 +280,6 @@ def pull(self, name, tag=None, **kwargs):
         Args:
             name (str): The repository to pull
             tag (str): The tag to pull
-            insecure_registry (bool): Use an insecure registry
             auth_config (dict): Override the credentials that
                 :py:meth:`~docker.client.DockerClient.login` has set for
                 this request. ``auth_config`` should contain the ``username``
@@ -305,12 +304,12 @@ def pull(self, name, tag=None, **kwargs):
             >>> images = client.images.pull('busybox')
         """
         if not tag:
-            name, tag = parse_repository_tag(name)
+            repository, tag = parse_repository_tag(repository)
 
-        self.client.api.pull(name, tag=tag, **kwargs)
+        self.client.api.pull(repository, tag=tag, **kwargs)
         if tag:
-            return self.get('{0}:{1}'.format(name, tag))
-        return self.list(name)
+            return self.get('{0}:{1}'.format(repository, tag))
+        return self.list(repository)
 
     def push(self, repository, tag=None, **kwargs):
         return self.client.api.push(repository, tag=tag, **kwargs)


Test patch: