This is an automated email from the ASF dual-hosted git repository.
oehler pushed a commit to branch 3767-add-jwt-authentication-to-python-client
in repository https://gitbox.apache.org/repos/asf/streampipes.git
The following commit(s) were added to
refs/heads/3767-add-jwt-authentication-to-python-client by this push:
new e7c2524e44 Add `refresh_headers` method to client
e7c2524e44 is described below
commit e7c2524e448f481f2dc0518e2a028acb0f1c7c48
Author: Sven Oehler <[email protected]>
AuthorDate: Tue Sep 9 14:06:39 2025 +0200
Add `refresh_headers` method to client
---
streampipes-client-python/streampipes/client/client.py | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/streampipes-client-python/streampipes/client/client.py
b/streampipes-client-python/streampipes/client/client.py
index 374f68569d..3157ce61df 100644
--- a/streampipes-client-python/streampipes/client/client.py
+++ b/streampipes-client-python/streampipes/client/client.py
@@ -136,8 +136,7 @@ class StreamPipesClient:
# set up a requests session
# this allows to centrally determine the behavior of all requests made
self.request_session = Session()
- self.request_session.headers.update(self.http_headers)
-
self.request_session.headers.update(self.client_config.additional_headers)
+ self.refresh_headers()
self.logging_level = logging_level
self._set_up_logging(logging_level=self.logging_level) # type: ignore
@@ -177,6 +176,12 @@ class StreamPipesClient:
return sp_version
+ def refresh_headers(self):
+ """Updates the header of the request session"""
+ self.request_session.headers.clear()
+ self.request_session.headers.update(self.http_headers)
+
self.request_session.headers.update(self.client_config.additional_headers)
+
@staticmethod
def _set_up_logging(logging_level: int) -> None:
"""Configures the logging behavior of the `StreamPipesClient`.