mirror of
https://github.com/drewkerrigan/nagios-http-json.git
synced 2024-11-22 18:33:49 +01:00
Update check_http_json.py
Added a request header to specify the Content-Type as application/json.
This commit is contained in:
parent
ba87c611df
commit
5d1100e646
@ -406,6 +406,7 @@ if __name__ == "__main__":
|
|||||||
# Attempt to reach the endpoint
|
# Attempt to reach the endpoint
|
||||||
try:
|
try:
|
||||||
req = urllib2.Request(url)
|
req = urllib2.Request(url)
|
||||||
|
req.add_header('Content-Type', 'application/json')
|
||||||
if args.auth:
|
if args.auth:
|
||||||
base64str = base64.encodestring(args.auth).replace('\n', '')
|
base64str = base64.encodestring(args.auth).replace('\n', '')
|
||||||
req.add_header('Authorization', 'Basic %s' % base64str)
|
req.add_header('Authorization', 'Basic %s' % base64str)
|
||||||
|
Loading…
Reference in New Issue
Block a user