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

Added argument for newly needed API token #5

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

aSilentSniper
Copy link

I added the needed token to the script

addet option to provide token
forgot token a second time.
Need more Coffee
forgot to change readme
@aSilentSniper aSilentSniper changed the title Added newly needed API token Added arggument for newly needed API token Jan 3, 2023
@aSilentSniper aSilentSniper changed the title Added arggument for newly needed API token Added argument for newly needed API token Jan 3, 2023
@wopfel
Copy link

wopfel commented Jan 3, 2023

Hi @aSilentSniper,
Thanks for mentioning my issue. I'll try your patch the next few days.

@wopfel
Copy link

wopfel commented Jan 6, 2023

I've tried your patched version. Works like a charm. Thanks!

@wopfel
Copy link

wopfel commented Jan 6, 2023

When pasting an empty, or wrong token, the check script crashes:

Traceback (most recent call last):
  File "/usr/local/bin/check_pihole.py", line 77, in <module>
    main()
  File "/usr/local/bin/check_pihole.py", line 64, in main
    if url_output["status"] != "enabled":
TypeError: list indices must be integers or slices, not str

Unfortunately, the Pihole API answers with a HTTP status code 200. So there's only checking for an empty result I think. Having my patch applied, the output is:

UNKNOWN: Empty result from Pihole. Wrong API token?

Maybe you wanna add this patch in this PR.
check_pihole.py.patch

(Apologies if this is not the best method for sharing the patch.)

added check for empty or wrong token
@aSilentSniper
Copy link
Author

@wopfel Thanks for your Patch it is working and i added it to this PR

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

Successfully merging this pull request may close these issues.

None yet

2 participants