Pyhton check_json: Add headerds (Token) to Python plugin

(Denny Fuchs) #1

hi,

I’ve found https://gitlab.com/Jedimaster0/check_json and its quite good, but I’m missing the option to add a authorization header / token. Can someone have a look on it and show me, which lines I have to change/add ?

Something like

headers = {}
headers['Authorization'] = 'Bearer %s" % token'

@nagiosplugin.guarded
def main():
...
    argp.add_argument('-t',  '--token',         help='Token for authorization')
....

cu denny

#2

Hi,

I saw that there is an open merge request which adds header support: https://gitlab.com/Jedimaster0/check_json/merge_requests/2

Is that sufficient for you?

Cheers
Michael

1 Like
(Denny Fuchs) #3

hi,

thanks for that hint. I tried it, but the call seems to be wrong. I’ve got en error: https://gitlab.com/austin.htet/check_json/commit/ac96f27bdb7a0b098da57741347fbe72ce34c7d0#note_137831219