use atexist to logout of kibana cleanly (#2095)
(cherry picked from commit e74ad241ca)
This commit is contained in:
committed by
github-actions[bot]
parent
8d4606d0dc
commit
da7270ec91
+8
-5
@@ -4,14 +4,15 @@
|
||||
# 2.0.
|
||||
|
||||
"""Wrapper around requests.Session for HTTP requests to Kibana."""
|
||||
import json
|
||||
import threading
|
||||
import atexit
|
||||
import base64
|
||||
import json
|
||||
import sys
|
||||
import threading
|
||||
import uuid
|
||||
|
||||
from elasticsearch import Elasticsearch
|
||||
import requests
|
||||
from elasticsearch import Elasticsearch
|
||||
|
||||
_context = threading.local()
|
||||
|
||||
@@ -57,8 +58,10 @@ class Kibana(object):
|
||||
self.elasticsearch = elasticsearch
|
||||
|
||||
if not verify:
|
||||
from requests.packages.urllib3.exceptions import InsecureRequestWarning
|
||||
from requests.packages.urllib3.exceptions import \
|
||||
InsecureRequestWarning
|
||||
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
|
||||
atexit.register(self.__close)
|
||||
|
||||
@property
|
||||
def version(self):
|
||||
@@ -179,7 +182,7 @@ class Kibana(object):
|
||||
self.session = requests.Session()
|
||||
self.elasticsearch = None
|
||||
|
||||
def __del__(self):
|
||||
def __close(self):
|
||||
if self.authenticated:
|
||||
self.logout()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user