Skip to content

TypeError: query() got an unexpected keyword argument 'json'. Did you mean '_json'? #94

@wojnilowicz

Description

@wojnilowicz

Type aw-client query my-query.txt and get an error as in the title.

The problem is that at line 101 --json is converted to json but used as _json on line 117.

aw-client/aw_client/cli.py

Lines 101 to 118 in 8f9483d

@click.option("--json", is_flag=True)
@click.option("--start", default=now - td1day, type=click.DateTime())
@click.option("--stop", default=now + td1yr, type=click.DateTime())
@click.pass_obj
def query(
obj: _Context,
path: str,
cache: bool,
_json: bool,
start: datetime,
stop: datetime,
name: Optional[str] = None,
):
with open(path) as f:
query = f.read()
result = obj.client.query(query, [(start, stop)], cache=cache, name=name)
if _json:
print(json.dumps(result))

The query switch is unusable because of that.

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