Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'ready --score' fails with TypeError if host is non-existent #40

Open
mejofi opened this issue Mar 23, 2024 · 0 comments
Open

'ready --score' fails with TypeError if host is non-existent #40

mejofi opened this issue Mar 23, 2024 · 0 comments

Comments

@mejofi
Copy link

mejofi commented Mar 23, 2024

When the host to be tested does not exist, ready returns a 'No response from' message, but if the --score flag is used, it also throws a TypeError, which is less than ideal. Example;

$ ready --score test.ur.nl
URL (no scheme): test.ur.nl, Domain (no path): test.ur.nl, Second Level Domain: ur.nl
No response from https://test.ur.nl
Traceback (most recent call last):
  File "/home/qa/.local/bin/ready", line 8, in <module>
    sys.exit(ready.cli())
             ^^^^^^^^^^^
  File "/home/qa/.local/pipx/venvs/ready-check/lib/python3.11/site-packages/ready/ready.py", line 447, in cli
    print(f"Score: {score_from_results(results)}/100")
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/qa/.local/pipx/venvs/ready-check/lib/python3.11/site-packages/ready/ready.py", line 381, in score_from_results
    return 100 - 3 * len([x for x in results if not x.passed and not x.warn_on_fail])
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: 'NoneType' object is not iterable

It probably wouldn't be a bad idea if it could distinguish between getting no response from an domain that actually exists, and getting a NXDOMAIN on DNS lookup, which is what is happening here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant