Skip to content

ipfsApi.Client should use defaults when given None as a value #7

Closed
@larsks

Description

@larsks

When host, port, or base is None, ipfsAPi.client.Client should use the default value rather than trying to work with None. This makes the module easier to use; consider, for example, if I have a Python client that includes:

import argparse

def parse_args():
    p = argparse.ArgumentParser()
    p.add_argument('--host')
    p.add_argument('--port')
    p.add_argument('--base')
    return p.parse_args()

I would like to be able to do this...

api = ipfsApi.Client(host=args.host, port=args.port, base=args.base)

...rather than requiring a complex set of conditionals to deal with various combinations of user-specified vs. user-wants-the-default values.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions