Skip to content

Commit

Permalink
(ipfs-shipyard#150) Allow None for connect()/Client to fallback to de…
Browse files Browse the repository at this point in the history
…fault values
  • Loading branch information
AuHau committed Feb 9, 2019
1 parent 20b69af commit ef16eeb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ipfshttpclient/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def assert_version(version, minimum=VERSION_MINIMUM, maximum=VERSION_MAXIMUM):
raise exceptions.VersionMismatch(version, minimum, maximum)


def connect(host=DEFAULT_HOST, port=DEFAULT_PORT, base=DEFAULT_BASE,
def connect(host=None, port=None, base=None,
chunk_size=multipart.default_chunk_size, **defaults):
"""Create a new :class:`~ipfshttpclient.Client` instance and connect to the
daemon to validate that its version is supported.
Expand Down
8 changes: 6 additions & 2 deletions ipfshttpclient/client/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,15 @@ class ClientBase(object):

_clientfactory = http.HTTPClient

def __init__(self, host=DEFAULT_HOST, port=DEFAULT_PORT,
base=DEFAULT_BASE, chunk_size=multipart.default_chunk_size,
def __init__(self, host=None, port=None,
base=None, chunk_size=multipart.default_chunk_size,
**defaults):
"""Connects to the API port of an IPFS node."""

host = host or DEFAULT_HOST
port = port or DEFAULT_PORT
base = base or DEFAULT_BASE

self.chunk_size = chunk_size

self._client = self._clientfactory(host, port, base, **defaults)

0 comments on commit ef16eeb

Please sign in to comment.