remove timeouts on ES connection

This commit is contained in:
simon 2023-01-14 13:21:50 +07:00
parent 89ac53083f
commit c0e36133a1
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4
1 changed files with 6 additions and 15 deletions

View File

@ -3,6 +3,7 @@ functionality:
- wrapper around requests to call elastic search
- reusable search_after to extract total index
"""
# pylint: disable=missing-timeout
import json
@ -55,16 +56,10 @@ class ElasticWrap:
if data:
response = requests.post(
self.url,
data=payload,
headers=headers,
auth=self.auth,
timeout=10,
self.url, data=payload, headers=headers, auth=self.auth
)
else:
response = requests.post(
self.url, headers=headers, auth=self.auth, timeout=10
)
response = requests.post(self.url, headers=headers, auth=self.auth)
if not response.ok:
print(response.text)
@ -75,9 +70,7 @@ class ElasticWrap:
"""put data to es"""
if refresh:
self.url = f"{self.url}/?refresh=true"
response = requests.put(
f"{self.url}", json=data, auth=self.auth, timeout=10
)
response = requests.put(f"{self.url}", json=data, auth=self.auth)
if not response.ok:
print(response.text)
print(data)
@ -90,11 +83,9 @@ class ElasticWrap:
if refresh:
self.url = f"{self.url}/?refresh=true"
if data:
response = requests.delete(
self.url, json=data, auth=self.auth, timeout=10
)
response = requests.delete(self.url, json=data, auth=self.auth)
else:
response = requests.delete(self.url, auth=self.auth, timeout=10)
response = requests.delete(self.url, auth=self.auth)
if not response.ok:
print(response.text)