From 688554998a57216406c9eda5927fe3d288e451d9 Mon Sep 17 00:00:00 2001 From: Aanand Prasad Date: Tue, 14 Jan 2014 17:19:39 +0000 Subject: [PATCH] Accept base_url of None This makes it very simple to get identical behaviour to the CLI: client = Client(os.environ.get('DOCKER_HOST')) --- docker/client.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docker/client.py b/docker/client.py index ebdc80b7..0c5c2950 100644 --- a/docker/client.py +++ b/docker/client.py @@ -65,9 +65,11 @@ class APIError(requests.exceptions.HTTPError): class Client(requests.Session): - def __init__(self, base_url="unix://var/run/docker.sock", version="1.6", + def __init__(self, base_url=None, version="1.6", timeout=DEFAULT_TIMEOUT_SECONDS): super(Client, self).__init__() + if base_url is None: + base_url = "unix://var/run/docker.sock" if base_url.startswith('unix:///'): base_url = base_url.replace('unix:/', 'unix:') if base_url.startswith('tcp:'):