diracx-client 0.0.1a19__py3-none-any.whl → 0.0.1a20__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.
@@ -10,6 +10,7 @@ from __future__ import annotations
10
10
 
11
11
  import abc
12
12
  import json
13
+ from importlib.metadata import PackageNotFoundError, distribution
13
14
  from types import TracebackType
14
15
  from pathlib import Path
15
16
  from typing import Any, List, Optional, Self
@@ -156,6 +157,20 @@ class DiracClientMixin(metaclass=abc.ABCMeta):
156
157
  # Get .well-known configuration
157
158
  openid_configuration = get_openid_configuration(self._endpoint, verify=verify)
158
159
 
160
+ try:
161
+ self.client_version = distribution("diracx").version
162
+ except PackageNotFoundError:
163
+ try:
164
+ self.client_version = distribution("diracx-client").version
165
+ except PackageNotFoundError:
166
+ print("Error while getting client version")
167
+ self.client_version = "Unknown"
168
+
169
+ # Setting default headers
170
+ kwargs.setdefault("base_headers", {})[
171
+ "DiracX-Client-Version"
172
+ ] = self.client_version
173
+
159
174
  # Initialize Dirac with a Dirac-specific token credential policy
160
175
  # We need to ignore types here because mypy complains that we give
161
176
  # too many arguments to "object" constructor as this is a mixin
@@ -1,10 +1,12 @@
1
1
  from __future__ import annotations
2
2
 
3
- from datetime import datetime, timezone
3
+
4
4
  import json
5
5
  import jwt
6
6
  import requests
7
7
 
8
+ from datetime import datetime, timezone
9
+ from importlib.metadata import PackageNotFoundError, distribution
8
10
 
9
11
  from pathlib import Path
10
12
  from typing import Any, Dict, List, Optional, cast, Self
@@ -221,6 +223,20 @@ class DiracClientMixin:
221
223
  # Get .well-known configuration
222
224
  openid_configuration = get_openid_configuration(self._endpoint, verify=verify)
223
225
 
226
+ try:
227
+ self.client_version = distribution("diracx").version
228
+ except PackageNotFoundError:
229
+ try:
230
+ self.client_version = distribution("diracx-client").version
231
+ except PackageNotFoundError:
232
+ print("Error while getting client version")
233
+ self.client_version = "Unknown"
234
+
235
+ # Setting default headers
236
+ kwargs.setdefault("base_headers", {})[
237
+ "DiracX-Client-Version"
238
+ ] = self.client_version
239
+
224
240
  # Initialize Dirac with a Dirac-specific token credential policy
225
241
  # We need to ignore types here because mypy complains that we give
226
242
  # too many arguments to "object" constructor as this is a mixin
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: diracx-client
3
- Version: 0.0.1a19
3
+ Version: 0.0.1a20
4
4
  Summary: TODO
5
5
  License: GPL-3.0-only
6
6
  Classifier: Intended Audience :: Science/Research
@@ -18,4 +18,3 @@ Provides-Extra: testing
18
18
  Requires-Dist: diracx-testing; extra == "testing"
19
19
  Provides-Extra: types
20
20
  Requires-Dist: types-requests; extra == "types"
21
-
@@ -0,0 +1,36 @@
1
+ diracx/client/__init__.py,sha256=aLo7lP4xwlCtxs7MKD55gr2oDLQyWEvRHZVHwj5Sl2c,165
2
+ diracx/client/aio.py,sha256=gqVCOxYYl-q6hrz6dbhiT8kXuYWZfQeIQLHAHF9liI4,37
3
+ diracx/client/extensions.py,sha256=igHJAXhgpYQq-Di1ZOX2b2okqgjQHTs9HL8mBTHb6ss,3385
4
+ diracx/client/models.py,sha256=ToGTZHywDTtn-uw1woTLxNAcSw1eRCx2A_kr67ix2Hw,163
5
+ diracx/client/py.typed,sha256=bWew9mHgMy8LqMu7RuqQXFXLBxh2CRx0dUbSx-3wE48,27
6
+ diracx/client/generated/__init__.py,sha256=vJe8ZP3hLFwRK36KPA2n6P4ti0nOXJgrOAhxN6bRuzU,719
7
+ diracx/client/generated/_client.py,sha256=e_LERq7nLIMtOUL84foK5S4kZAOF9mJlFOdAcdGCwDs,4831
8
+ diracx/client/generated/_configuration.py,sha256=qzFZ089UDtXIYEClN5w6iJj0Hm72qy_FL0pJsXathfM,1936
9
+ diracx/client/generated/_patch.py,sha256=ZsuUeieEbKp0OjXJz2qAW-z6W0Xt8wwb38J-RvQxfNE,1328
10
+ diracx/client/generated/_serialization.py,sha256=4C5vtTgquShn3QH7J2QaSEukQIMLW67tfNoEdGvWn5k,86948
11
+ diracx/client/generated/_vendor.py,sha256=M1s4hEh-jejSih4eDGzFu1MQkNyWQM5pmzMxyp0eBCE,1936
12
+ diracx/client/generated/py.typed,sha256=bWew9mHgMy8LqMu7RuqQXFXLBxh2CRx0dUbSx-3wE48,27
13
+ diracx/client/generated/aio/__init__.py,sha256=vJe8ZP3hLFwRK36KPA2n6P4ti0nOXJgrOAhxN6bRuzU,719
14
+ diracx/client/generated/aio/_client.py,sha256=ctZbEdAhSPJtDYWsbh8nfvbXI_C932xd58T0Mw0q-dk,4952
15
+ diracx/client/generated/aio/_configuration.py,sha256=6V0bK2A8i_0Au-ojhZOSqYIgYTe3QkVyFADKygWWHDQ,1968
16
+ diracx/client/generated/aio/_patch.py,sha256=6FYNV6Yt0ttTc7A5EQui764Ujuzypkjpv47LVdccmD8,697
17
+ diracx/client/generated/aio/_vendor.py,sha256=M1s4hEh-jejSih4eDGzFu1MQkNyWQM5pmzMxyp0eBCE,1936
18
+ diracx/client/generated/aio/operations/__init__.py,sha256=FcU_imELohqiaOtPzeopEEPTAXgsvrIqgXjFK6VmltU,887
19
+ diracx/client/generated/aio/operations/_operations.py,sha256=JelQdNzyG5bBISE42vtbt0PL4E2iJLBXKONNMdxVhgM,95035
20
+ diracx/client/generated/aio/operations/_patch.py,sha256=3oHjHqBF7DXruMSVUTRxW0Xpv_mY1WaB8iyo47YBTec,4229
21
+ diracx/client/generated/models/__init__.py,sha256=dWjCnKAE_-4-biZ5yX9TTRZnKgtqh4psNmGOL5tFwwU,3129
22
+ diracx/client/generated/models/_enums.py,sha256=5JfOHTo7OQXAHqaoRDwiyKI3LyS0sTgxetEJ0Wjk2_I,2389
23
+ diracx/client/generated/models/_models.py,sha256=k-YMiEs8SO3ArL6Q5dcRWoW8faM_4I17MBQsdssSwa8,39708
24
+ diracx/client/generated/models/_patch.py,sha256=uvLwKzjWO_t-VZ4aSuLhuJ05RVxAP9UJxZV3XDeGMnU,1497
25
+ diracx/client/generated/operations/__init__.py,sha256=FcU_imELohqiaOtPzeopEEPTAXgsvrIqgXjFK6VmltU,887
26
+ diracx/client/generated/operations/_operations.py,sha256=iXr64Yr519jJtLjjoWVM4FNtiaqqg9cAS2GSIlfS8Nw,119966
27
+ diracx/client/generated/operations/_patch.py,sha256=FvemlcswH_zZkdyoGObyTwRnwTsYIZJa3seO66C2BQI,4202
28
+ diracx/client/patches/__init__.py,sha256=8mzMyg1Kd9lJH1K7DYJ6FgjkTJgPRJmF0sYmuFv5wcs,468
29
+ diracx/client/patches/utils.py,sha256=3HSRDgdv0Ssxe53lVRFp-qlXU0Gz5mse2EqXcVmL9a0,8978
30
+ diracx/client/patches/aio/__init__.py,sha256=qIy1qj8HzaZDEU2PCjEHjFbylwfYRAM0i90WEDs2WuQ,471
31
+ diracx/client/patches/aio/utils.py,sha256=smZhoXpqZaWh1GV34oJdNcLRgogZtkWPmflHPq49O3A,6986
32
+ diracx_client-0.0.1a20.dist-info/METADATA,sha256=R20omnd-mfFWp-xo45anxzMM72tqbb9-boSqyA5yYzA,676
33
+ diracx_client-0.0.1a20.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
34
+ diracx_client-0.0.1a20.dist-info/entry_points.txt,sha256=NP67B7z-VIy8vEG3ZYtOAyxZqLtrOAD5hh2pA2AFBKI,123
35
+ diracx_client-0.0.1a20.dist-info/top_level.txt,sha256=vJx10tdRlBX3rF2Psgk5jlwVGZNcL3m_7iQWwgPXt-U,7
36
+ diracx_client-0.0.1a20.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.1.0)
2
+ Generator: setuptools (75.6.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,36 +0,0 @@
1
- diracx/client/__init__.py,sha256=aLo7lP4xwlCtxs7MKD55gr2oDLQyWEvRHZVHwj5Sl2c,165
2
- diracx/client/aio.py,sha256=gqVCOxYYl-q6hrz6dbhiT8kXuYWZfQeIQLHAHF9liI4,37
3
- diracx/client/extensions.py,sha256=igHJAXhgpYQq-Di1ZOX2b2okqgjQHTs9HL8mBTHb6ss,3385
4
- diracx/client/models.py,sha256=ToGTZHywDTtn-uw1woTLxNAcSw1eRCx2A_kr67ix2Hw,163
5
- diracx/client/py.typed,sha256=bWew9mHgMy8LqMu7RuqQXFXLBxh2CRx0dUbSx-3wE48,27
6
- diracx/client/generated/__init__.py,sha256=B9QWqpEmloFGgHcz5Qr_JhZ1VWuue3bFqG8P8tNRnOo,699
7
- diracx/client/generated/_client.py,sha256=Ucb7XVfbGg3wwzyUzyXVM7vHyHpiVY_SI-hLIlrzM10,4831
8
- diracx/client/generated/_configuration.py,sha256=cV68TslcEaEz1UC9I1w0fD97B8Qd-qp4e9DdnN52RNo,1936
9
- diracx/client/generated/_patch.py,sha256=ZsuUeieEbKp0OjXJz2qAW-z6W0Xt8wwb38J-RvQxfNE,1328
10
- diracx/client/generated/_serialization.py,sha256=D2NDvU1N7HsRxZcro5RqQsjwzeVrW89OfQABp2m-RT8,86957
11
- diracx/client/generated/_vendor.py,sha256=G4uvSqVEkCV40TKFEGOXRzs4kjAx70wPBNPS8cdzSBg,1936
12
- diracx/client/generated/py.typed,sha256=bWew9mHgMy8LqMu7RuqQXFXLBxh2CRx0dUbSx-3wE48,27
13
- diracx/client/generated/aio/__init__.py,sha256=B9QWqpEmloFGgHcz5Qr_JhZ1VWuue3bFqG8P8tNRnOo,699
14
- diracx/client/generated/aio/_client.py,sha256=sT_kcTQdSmZctC-uVACv_KvtUQUANbYNorpz31tcGsc,4952
15
- diracx/client/generated/aio/_configuration.py,sha256=XLwTMklUFCJUPdY7nyx2YjLHyu23q6H0nPYgbQfsr48,1968
16
- diracx/client/generated/aio/_patch.py,sha256=6FYNV6Yt0ttTc7A5EQui764Ujuzypkjpv47LVdccmD8,697
17
- diracx/client/generated/aio/_vendor.py,sha256=G4uvSqVEkCV40TKFEGOXRzs4kjAx70wPBNPS8cdzSBg,1936
18
- diracx/client/generated/aio/operations/__init__.py,sha256=GHpFQ9Xm5etewGThBTvKhKms0KHnhp2_vuNkb6na8a0,868
19
- diracx/client/generated/aio/operations/_operations.py,sha256=5h5c7NFGLOi53yxgC4ZPO4joSNysax4O4hxpDnNGNPE,99551
20
- diracx/client/generated/aio/operations/_patch.py,sha256=3oHjHqBF7DXruMSVUTRxW0Xpv_mY1WaB8iyo47YBTec,4229
21
- diracx/client/generated/models/__init__.py,sha256=1W96tTA46xJpxwVE73kswpIkUwuKZAVxKdr7mdUgykw,3110
22
- diracx/client/generated/models/_enums.py,sha256=xhX35Xy2EkLB1gX5TyOSFTV0pw9iAgR98UenK5yKB2o,2389
23
- diracx/client/generated/models/_models.py,sha256=WJoQCHRJ0rXehIr0gUwNNfKXp9uIifKb8smXmH0IQoE,39799
24
- diracx/client/generated/models/_patch.py,sha256=uvLwKzjWO_t-VZ4aSuLhuJ05RVxAP9UJxZV3XDeGMnU,1497
25
- diracx/client/generated/operations/__init__.py,sha256=GHpFQ9Xm5etewGThBTvKhKms0KHnhp2_vuNkb6na8a0,868
26
- diracx/client/generated/operations/_operations.py,sha256=jv07HbP9JF0DF56eyu7FYYjW4DSB1GxjMDHVRkM1LvY,124482
27
- diracx/client/generated/operations/_patch.py,sha256=FvemlcswH_zZkdyoGObyTwRnwTsYIZJa3seO66C2BQI,4202
28
- diracx/client/patches/__init__.py,sha256=8mzMyg1Kd9lJH1K7DYJ6FgjkTJgPRJmF0sYmuFv5wcs,468
29
- diracx/client/patches/utils.py,sha256=srbqBTsnNUKajHAP4aT3hR29P6rmJlsojIiJdMBW9wo,8403
30
- diracx/client/patches/aio/__init__.py,sha256=qIy1qj8HzaZDEU2PCjEHjFbylwfYRAM0i90WEDs2WuQ,471
31
- diracx/client/patches/aio/utils.py,sha256=d_OvqJuzJUfmeSmfmDD3J6CArVW3M9BZg9fnslzltKQ,6412
32
- diracx_client-0.0.1a19.dist-info/METADATA,sha256=7gHtve3zQW3j57bJyUOVYOoTykIkwGtjpVyi39uK5wg,677
33
- diracx_client-0.0.1a19.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
34
- diracx_client-0.0.1a19.dist-info/entry_points.txt,sha256=NP67B7z-VIy8vEG3ZYtOAyxZqLtrOAD5hh2pA2AFBKI,123
35
- diracx_client-0.0.1a19.dist-info/top_level.txt,sha256=vJx10tdRlBX3rF2Psgk5jlwVGZNcL3m_7iQWwgPXt-U,7
36
- diracx_client-0.0.1a19.dist-info/RECORD,,