brynq-sdk-elastic 2.2.1__tar.gz → 2.2.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {brynq_sdk_elastic-2.2.1 → brynq_sdk_elastic-2.2.2}/PKG-INFO +1 -1
- {brynq_sdk_elastic-2.2.1 → brynq_sdk_elastic-2.2.2}/brynq_sdk/elastic/elastic.py +7 -6
- {brynq_sdk_elastic-2.2.1 → brynq_sdk_elastic-2.2.2}/brynq_sdk_elastic.egg-info/PKG-INFO +1 -1
- {brynq_sdk_elastic-2.2.1 → brynq_sdk_elastic-2.2.2}/setup.py +1 -1
- {brynq_sdk_elastic-2.2.1 → brynq_sdk_elastic-2.2.2}/brynq_sdk/elastic/__init__.py +0 -0
- {brynq_sdk_elastic-2.2.1 → brynq_sdk_elastic-2.2.2}/brynq_sdk_elastic.egg-info/SOURCES.txt +0 -0
- {brynq_sdk_elastic-2.2.1 → brynq_sdk_elastic-2.2.2}/brynq_sdk_elastic.egg-info/dependency_links.txt +0 -0
- {brynq_sdk_elastic-2.2.1 → brynq_sdk_elastic-2.2.2}/brynq_sdk_elastic.egg-info/not-zip-safe +0 -0
- {brynq_sdk_elastic-2.2.1 → brynq_sdk_elastic-2.2.2}/brynq_sdk_elastic.egg-info/requires.txt +0 -0
- {brynq_sdk_elastic-2.2.1 → brynq_sdk_elastic-2.2.2}/brynq_sdk_elastic.egg-info/top_level.txt +0 -0
- {brynq_sdk_elastic-2.2.1 → brynq_sdk_elastic-2.2.2}/setup.cfg +0 -0
|
@@ -17,6 +17,7 @@ class Elastic:
|
|
|
17
17
|
try:
|
|
18
18
|
self.verify = False
|
|
19
19
|
self.disabled = disabled
|
|
20
|
+
self.timeout = 60 # seconds before request to elastic fails
|
|
20
21
|
elasticsearch_host = os.getenv("ELASTIC_HOST")
|
|
21
22
|
elasticsearch_port = os.getenv("ELASTIC_PORT")
|
|
22
23
|
kibana_port = os.getenv("KIBANA_PORT")
|
|
@@ -75,7 +76,7 @@ class Elastic:
|
|
|
75
76
|
return 'Healthy connection established with elasticsearch!'
|
|
76
77
|
|
|
77
78
|
try:
|
|
78
|
-
health = requests.get(url=f'{self.elasticsearch_host}/_cat/health?', headers=self.elastic_headers, verify=self.verify).status_code
|
|
79
|
+
health = requests.get(url=f'{self.elasticsearch_host}/_cat/health?', headers=self.elastic_headers, verify=self.verify, timeout=self.timeout).status_code
|
|
79
80
|
if health != 200:
|
|
80
81
|
raise ConnectionError(f"Elasticsearch cluster health check failed with status code: {health}")
|
|
81
82
|
else:
|
|
@@ -185,7 +186,7 @@ class Elastic:
|
|
|
185
186
|
|
|
186
187
|
# initial request
|
|
187
188
|
params = {"size": size, "scroll": "10m"}
|
|
188
|
-
response = requests.get(url=url, headers=self.elastic_headers, params=params, verify=self.verify).json()
|
|
189
|
+
response = requests.get(url=url, headers=self.elastic_headers, params=params, verify=self.verify, timeout=self.timeout).json()
|
|
189
190
|
|
|
190
191
|
# next requests until finished
|
|
191
192
|
scroll_id = response['_scroll_id']
|
|
@@ -356,7 +357,7 @@ class Elastic:
|
|
|
356
357
|
|
|
357
358
|
url = f'{self.elasticsearch_host}/{index_name}/_doc/'
|
|
358
359
|
body = json.dumps(document)
|
|
359
|
-
response = requests.post(url=url, data=body, headers=self.elastic_headers, verify=self.verify)
|
|
360
|
+
response = requests.post(url=url, data=body, headers=self.elastic_headers, verify=self.verify, timeout=self.timeout)
|
|
360
361
|
return response
|
|
361
362
|
|
|
362
363
|
def get_document(self, index_name: str, document_id: str) -> requests.Response:
|
|
@@ -370,7 +371,7 @@ class Elastic:
|
|
|
370
371
|
return None
|
|
371
372
|
|
|
372
373
|
url = f'{self.elasticsearch_host}/{index_name}/_doc/{document_id}'
|
|
373
|
-
response = requests.get(url=url, headers=self.elastic_headers, verify=self.verify)
|
|
374
|
+
response = requests.get(url=url, headers=self.elastic_headers, verify=self.verify, timeout=self.timeout)
|
|
374
375
|
return response
|
|
375
376
|
|
|
376
377
|
def delete_document(self, index_name: str, document_id: str) -> requests.Response:
|
|
@@ -384,7 +385,7 @@ class Elastic:
|
|
|
384
385
|
return None
|
|
385
386
|
|
|
386
387
|
url = f'{self.elasticsearch_host}/{index_name}/_doc/{document_id}'
|
|
387
|
-
response = requests.delete(url=url, headers=self.elastic_headers, verify=self.verify)
|
|
388
|
+
response = requests.delete(url=url, headers=self.elastic_headers, verify=self.verify, timeout=self.timeout)
|
|
388
389
|
return response
|
|
389
390
|
|
|
390
391
|
def task_execution_log(self, information: dict) -> requests.Response:
|
|
@@ -399,7 +400,7 @@ class Elastic:
|
|
|
399
400
|
# Add new document
|
|
400
401
|
url = f'{self.elasticsearch_host}/task_execution_log_{self.client_user}/_doc/'
|
|
401
402
|
body = json.dumps(information)
|
|
402
|
-
response = requests.post(url=url, data=body, headers=self.elastic_headers, verify=self.verify)
|
|
403
|
+
response = requests.post(url=url, data=body, headers=self.elastic_headers, verify=self.verify, timeout=self.timeout)
|
|
403
404
|
return response
|
|
404
405
|
|
|
405
406
|
@staticmethod
|
|
File without changes
|
|
File without changes
|
{brynq_sdk_elastic-2.2.1 → brynq_sdk_elastic-2.2.2}/brynq_sdk_elastic.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{brynq_sdk_elastic-2.2.1 → brynq_sdk_elastic-2.2.2}/brynq_sdk_elastic.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|