fix: change password for builtin users

This commit is contained in:
Adrien Waksberg 2023-10-17 09:47:10 +02:00
parent f1ba54d2ad
commit 0ab1bd2023
4 changed files with 61 additions and 6 deletions

View file

@ -20,6 +20,20 @@ class ElasticsearchApi:
return r.status_code, r.json()
def post(self, path, data):
r = requests.post(
'{}/{}'.format(self.url, path),
auth=self.basic,
json=data
)
if r.status_code == 500:
raise Exception('Server return 500 error: {}'.format(r.text))
elif r.status_code == 401:
raise Exception('Authentification has failed')
elif r.status_code != 200:
raise Exception('Server return an unknown error: {}'.format(r.text))
def put(self, path, data):
r = requests.put(
'{}/{}'.format(self.url, path),