Added default User-Agent header

* prevent errors for services which require this header (like Cloudflare WAF)
This commit is contained in:
Ricardo Bartels 2019-05-09 15:53:59 +02:00
parent 1173420803
commit 7858382bbe

View File

@ -731,6 +731,7 @@ if __name__ == "__main__":
debugPrint(args.debug, "url:%s" % url) debugPrint(args.debug, "url:%s" % url)
try: try:
req = urllib2.Request(url) req = urllib2.Request(url)
req.add_header("User-Agent", "check_http_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)