lsrestclient 3.3.0__tar.gz → 3.3.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.
@@ -1,12 +1,13 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lsrestclient
3
- Version: 3.3.0
3
+ Version: 3.3.2
4
4
  Summary: REST Api Client
5
5
  Author: mba
6
6
  Author-email: bartel@electronic-shop.lu
7
7
  Requires-Python: >=3.12,<4.0
8
8
  Classifier: Programming Language :: Python :: 3
9
9
  Provides-Extra: redis
10
+ Requires-Dist: fastapi-lsoft (>=1.0.2,<2.0.0)
10
11
  Requires-Dist: lsjsonclasses (>=2.0.1,<3.0.0)
11
12
  Requires-Dist: pydantic (>=2.11.7,<3.0.0)
12
13
  Requires-Dist: pydantic-settings (>=2.10.1,<3.0.0)
@@ -113,6 +113,11 @@ class LsRestClient(object):
113
113
  super().__init__()
114
114
  self._clients[name] = self
115
115
 
116
+ def clear_cache(self):
117
+ if not isinstance(self._session, CachedSession):
118
+ raise Exception("Cache not enabled.")
119
+ self._session.cache.clear()
120
+
116
121
  def cache_filter(self, response: Response) -> bool:
117
122
  settings = LsRestClientSettings()
118
123
  cache_control = response.headers.get("Cache-Control")
@@ -24,10 +24,10 @@ class LsFastApiClientBase(ABC):
24
24
  return cls._client
25
25
 
26
26
  @classmethod
27
- def register(cls, base_url: str = None) -> LsRestClient:
27
+ def register(cls, base_url: str = None, **kwargs) -> LsRestClient:
28
28
  # noinspection PyArgumentList
29
29
  log.debug(f"Registering {cls.client_name} API client at {base_url}")
30
- cls._client = LsRestClient(name=cls.client_name, base_url=base_url or cls.base_url())
30
+ cls._client = LsRestClient(name=cls.client_name, base_url=base_url or cls.base_url(), **kwargs)
31
31
  return cls._client
32
32
 
33
33
  @classmethod
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "lsrestclient"
3
- version = "3.3.0"
3
+ version = "3.3.2"
4
4
  description = "REST Api Client"
5
5
  authors = ["mba <bartel@electronic-shop.lu>"]
6
6
  readme = "README.md"
@@ -15,6 +15,7 @@ requests-cache = "^1.2.1"
15
15
  pydantic = "^2.11.7"
16
16
  pydantic-settings = "^2.10.1"
17
17
  redis = "^6.4.0"
18
+ fastapi-lsoft = "^1.0.2"
18
19
 
19
20
  [tool.poetry.group.dev.dependencies]
20
21
  pytest = "^7.4.0"
@@ -22,7 +23,7 @@ black = "^23.7.0"
22
23
  fastapi = "^0.104.1"
23
24
  uvicorn = "^0.35.0"
24
25
  killport = "^1.2.0"
25
- fastapi-lsoft = "^1.0.0"
26
+ fastapi-lsoft = "^1.0.2"
26
27
 
27
28
  [tool.poetry.extras]
28
29
  redis = ["redis"]
File without changes