Skip to content

Commit

Permalink
Fixing auth
Browse files Browse the repository at this point in the history
Signed-off-by: Jürgen Löhel <juergen.loehel@inlyse.com>
  • Loading branch information
jloehel committed Jul 3, 2020
1 parent bb07fb8 commit d0522d8
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions logstash_async/transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,18 +464,17 @@ def send(self, events: list, **kwargs: dict) -> None:
:type use_logging: bool
"""
self.__session = requests.Session()
if self.__auth() is not None:
self.__session.auth = self.__auth()
self.__session.verify = self.ssl_verify
for event in events:
attempt = 0
while attempt < self.__max_attempts:
if self.codec.lower() == "json":
response = requests.post(
self.url, json=self.encode(event), headers=self.headers)
self.url, json=self.encode(event), headers=self.headers,
verify=self.ssl_verify, auth=self.__auth)
else:
response = requests.post(
self.url, data=self.encode(event), headers=self.headers)
self.url, data=self.encode(event), headers=self.headers,
verify=self.ssl_verify, auth=self.__auth)
status_code = response.status_code
if status_code == 200:
break
Expand Down

0 comments on commit d0522d8

Please sign in to comment.