mirror of https://github.com/docker/docker-py.git
Accept base_url of None
This makes it very simple to get identical behaviour to the CLI:
client = Client(os.environ.get('DOCKER_HOST'))
This commit is contained in:
parent
96932fc1cb
commit
688554998a
|
|
@ -65,9 +65,11 @@ class APIError(requests.exceptions.HTTPError):
|
||||||
|
|
||||||
|
|
||||||
class Client(requests.Session):
|
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):
|
timeout=DEFAULT_TIMEOUT_SECONDS):
|
||||||
super(Client, self).__init__()
|
super(Client, self).__init__()
|
||||||
|
if base_url is None:
|
||||||
|
base_url = "unix://var/run/docker.sock"
|
||||||
if base_url.startswith('unix:///'):
|
if base_url.startswith('unix:///'):
|
||||||
base_url = base_url.replace('unix:/', 'unix:')
|
base_url = base_url.replace('unix:/', 'unix:')
|
||||||
if base_url.startswith('tcp:'):
|
if base_url.startswith('tcp:'):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue