Skip to content

Commit 9a9dc82

Browse files
committed
Merge pull request #8 from larsks/bug/7
use defaults when host, port, or base == None
2 parents 1f4831f + 5d2b064 commit 9a9dc82

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

ipfsApi/client.py

+13-3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
FileCommand
99
from .exceptions import InvalidCommand
1010

11+
default_host = 'localhost'
12+
default_port = 5001
13+
default_base = 'api/v0'
1114

1215

1316
class Client(object):
@@ -16,11 +19,18 @@ class Client(object):
1619

1720

1821
def __init__(self,
19-
host='127.0.0.1',
20-
port=5001,
21-
base='api/v0',
22+
host=None,
23+
port=None,
24+
base=None,
2225
default_enc='json',
2326
**defaults):
27+
28+
if host is None:
29+
host = default_host
30+
if port is None:
31+
port = default_port
32+
if base is None:
33+
base = default_base
2434

2535
self._client = self.__client__(host, port, base, default_enc)
2636

0 commit comments

Comments
 (0)