nextlayer-sdk-python 1.3.0__py3-none-any.whl → 1.3.2__py3-none-any.whl

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.
nextlayer/sdk/__init__.py CHANGED
@@ -1,2 +1,2 @@
1
1
  # do not edit this version line, it will be updated in CI-Pipeline!
2
- __version__ = "v1.3.0"
2
+ __version__ = "v1.3.2"
nextlayer/sdk/auth.py CHANGED
@@ -201,6 +201,10 @@ class NlAuth(object):
201
201
  def refresh_expired(self) -> bool:
202
202
  now = int(time.time())
203
203
  exp_at = self.store.config.refresh_expires_at
204
+ if exp_at == 0:
205
+ # sentinel set by update_tokens(): refresh token has no expiry
206
+ # (no `exp` claim) - which is valid per the JWT/OAuth2 spec
207
+ return False
204
208
  is_expired = not exp_at or exp_at <= now
205
209
  if is_expired and exp_at:
206
210
  log.debug(f"refresh_token is expired {exp_at!r}")
@@ -226,14 +230,21 @@ class NlAuth(object):
226
230
  tokens["expires_in"] * 0.75
227
231
  )
228
232
  refresh_expires_in = tokens.get("refresh_expires_in")
229
- # client_credentials grant responses typically have no refresh_token /
230
- # refresh_expires_in at all - there is nothing to refresh in that case,
231
- # so None (rather than some made-up default) is the correct value here
232
- self.store.config.refresh_expires_at = (
233
- int(time.time()) + int(refresh_expires_in * 0.75)
234
- if refresh_expires_in is not None
235
- else None
236
- )
233
+ if refresh_expires_in is None:
234
+ # client_credentials grant responses typically have no refresh_token /
235
+ # refresh_expires_in at all - there is nothing to refresh in that case,
236
+ # so None (rather than some made-up default) is the correct value here
237
+ self.store.config.refresh_expires_at = None
238
+ elif refresh_expires_in == 0:
239
+ # refresh_expires_in == 0 means the refresh token itself has no
240
+ # `exp` claim / never expires - perfectly valid per the JWT/OAuth2
241
+ # spec and must not be treated as "already expired" (0 is used as
242
+ # a sentinel for "never expires", see refresh_expired())
243
+ self.store.config.refresh_expires_at = 0
244
+ else:
245
+ self.store.config.refresh_expires_at = int(time.time()) + int(
246
+ refresh_expires_in * 0.75
247
+ )
237
248
  self.store.config.tokens = tokens
238
249
  return tokens["access_token"]
239
250
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nextlayer-sdk-python
3
- Version: 1.3.0
3
+ Version: 1.3.2
4
4
  Summary: Client utilities to interact with next layer public APIs
5
5
  Author: Wolfgang Powisch
6
6
  Author-email: wolfgang.powisch@nextlayer.at
@@ -12,6 +12,7 @@ Classifier: Programming Language :: Python :: 3.11
12
12
  Classifier: Programming Language :: Python :: 3.12
13
13
  Classifier: Programming Language :: Python :: 3.13
14
14
  Classifier: Programming Language :: Python :: 3.14
15
+ Classifier: Programming Language :: Python :: 3.15
15
16
  Requires-Dist: PyYAML (>=6.0,<7.0)
16
17
  Requires-Dist: httpx (>=0.28.1,<0.29.0)
17
18
  Requires-Dist: pydantic (>=2.12.5,<3.0.0)
@@ -0,0 +1,11 @@
1
+ nextlayer/sdk/__init__.py,sha256=BV71IeNbEW6chI5XYgcLGlTeLvQDB40DPbj1x3dr_ug,91
2
+ nextlayer/sdk/__init__.pye,sha256=fIfxryYAp41WbubhUjhitrpwoi6wXFQCZL40RdI4tHA,90
3
+ nextlayer/sdk/auth.py,sha256=wo1sVBqmGfMk23Qo5l5E-npN2buO1s6go7BmVvCSMzo,17462
4
+ nextlayer/sdk/auth_code_browser_flow.py,sha256=luPScN2WFJtBzUc-6jEGx1zx3cjfgsl1UQweikD3y90,4648
5
+ nextlayer/sdk/auth_httpx.py,sha256=aAd3cABajn7vH9ZGgh_zQVwQos-cpHHFuieu2Xgeasc,1594
6
+ nextlayer/sdk/errors.py,sha256=ZylQSsiFOulLaFwIeBHK0ZWo2Vn6AjML8PoNGIDdx8c,430
7
+ nextlayer/sdk/utils.py,sha256=JPkPuy1bU4jBOf0NunYWMqwrwKmNa2OKNTGPv_UaH6s,583
8
+ nextlayer_sdk_python-1.3.2.dist-info/METADATA,sha256=ykxMGxKcYqTLmwcY_dwNYHwjPkjhUPT4NCJ0IQnA_SE,4155
9
+ nextlayer_sdk_python-1.3.2.dist-info/WHEEL,sha256=L-WvLdSBvJWHXv5zrQxDvNRnIgoBzLUpcbuiw19KCuQ,88
10
+ nextlayer_sdk_python-1.3.2.dist-info/entry_points.txt,sha256=d2f4hShiG0Z_TDG72fCWJdOUZkXPfmPBUIieDXh94d0,58
11
+ nextlayer_sdk_python-1.3.2.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 2.4.0
2
+ Generator: poetry-core 2.5.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
@@ -1,11 +0,0 @@
1
- nextlayer/sdk/__init__.py,sha256=xluvcXl-OARwrx45L8m0tO7b1qpMyGHYi8V_fasDVhM,91
2
- nextlayer/sdk/__init__.pye,sha256=fIfxryYAp41WbubhUjhitrpwoi6wXFQCZL40RdI4tHA,90
3
- nextlayer/sdk/auth.py,sha256=nfrjg4CDC7Da_nRNo20qiOE2WJqYFPmUuhgHB9pptq4,16810
4
- nextlayer/sdk/auth_code_browser_flow.py,sha256=luPScN2WFJtBzUc-6jEGx1zx3cjfgsl1UQweikD3y90,4648
5
- nextlayer/sdk/auth_httpx.py,sha256=aAd3cABajn7vH9ZGgh_zQVwQos-cpHHFuieu2Xgeasc,1594
6
- nextlayer/sdk/errors.py,sha256=ZylQSsiFOulLaFwIeBHK0ZWo2Vn6AjML8PoNGIDdx8c,430
7
- nextlayer/sdk/utils.py,sha256=JPkPuy1bU4jBOf0NunYWMqwrwKmNa2OKNTGPv_UaH6s,583
8
- nextlayer_sdk_python-1.3.0.dist-info/METADATA,sha256=bqUTZcpoloilOIC0QJc6M21iJs6BBpTzk5jgOcFNpKM,4104
9
- nextlayer_sdk_python-1.3.0.dist-info/WHEEL,sha256=EGEvSphFYqXKs23-kQBeyNoJP1nrT8ZJKQoi5p5DYL8,88
10
- nextlayer_sdk_python-1.3.0.dist-info/entry_points.txt,sha256=d2f4hShiG0Z_TDG72fCWJdOUZkXPfmPBUIieDXh94d0,58
11
- nextlayer_sdk_python-1.3.0.dist-info/RECORD,,