martinbrose/cloudflarepycli

Option --json doesn't return proper json with version 1.8

Closed this issue · 2 comments

Hi @tevslin,

when using command cfspeedtest --json with version 1.8, the tool doesn't return proper json.
When running the output through json.loads(), I receive the following error message: json.decoder.JSONDecodeError: Extra data: line 2 column 1 (char 1151).

I believe the reason are the additional prints you introduced in src/cloudflarepycli/__main__.py lines 38-42.

If you prefer to keep them, would it be possible to put them into an else as part of the if args.json:?

Thank you!

Martin, thank you.

It'll probably be a week until I can accept the pr and update pypi but will do.

Thanks Tom.

Take your time. As a workaround for now, I just cut off the additional prints with an output.rsplit().