cwyodmodules 0.3.28__py3-none-any.whl → 0.3.29__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.
@@ -1,3 +1,4 @@
1
+ import os
1
2
  from azure.identity import (
2
3
  ChainedTokenCredential,
3
4
  ManagedIdentityCredential,
@@ -22,6 +23,8 @@ class AzureIdentityHelper:
22
23
  # Configure in-memory token cache persistence
23
24
  # For in-memory, unencrypted storage is typically allowed for simplicity during development.
24
25
  # In production, especially with shared environments, consider the security implications.
26
+ client_secret_available = os.getenv("AZURE_CLIENT_SECRET") is not None
27
+
25
28
  token_cache_options = TokenCachePersistenceOptions(allow_unencrypted_storage=True)
26
29
 
27
30
  # Create individual credential instances
@@ -34,10 +37,18 @@ class AzureIdentityHelper:
34
37
 
35
38
  # Create a chain of credentials
36
39
  # The chain will try credentials in the order they are provided.
37
- self._credential = ChainedTokenCredential(
38
- managed_identity_credential,
39
- environment_credential
40
- )
40
+ if client_secret_available:
41
+ logger.info("Using Environment Credential first with token cache persistence.")
42
+ self._credential = ChainedTokenCredential(
43
+ environment_credential,
44
+ managed_identity_credential
45
+ )
46
+ else:
47
+ logger.info("Using Managed Identity Credential first with token cache persistence.")
48
+ self._credential = ChainedTokenCredential(
49
+ managed_identity_credential,
50
+ environment_credential
51
+ )
41
52
 
42
53
  def get_credential(self) -> ChainedTokenCredential:
43
54
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cwyodmodules
3
- Version: 0.3.28
3
+ Version: 0.3.29
4
4
  Summary: Add your description here
5
5
  Author-email: Patrik <patrikhartl@gmail.com>
6
6
  Classifier: Operating System :: OS Independent
@@ -30,7 +30,7 @@ cwyodmodules/batch/utilities/helpers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeu
30
30
  cwyodmodules/batch/utilities/helpers/azure_blob_storage_client.py,sha256=FN2XnEThmtbWnwSi1sEfgekuPH7aJBOAU5n2DBmQ9ww,10315
31
31
  cwyodmodules/batch/utilities/helpers/azure_computer_vision_client.py,sha256=5qhxriTEaKkRc8K4E9oKQjCOzV_JSkad37z1FskCpOg,3661
32
32
  cwyodmodules/batch/utilities/helpers/azure_form_recognizer_helper.py,sha256=kN9pjanKj_IsGM0XQA8QwICuLaB0yBdtRMINmhSD_mU,6699
33
- cwyodmodules/batch/utilities/helpers/azure_identity_helper.py,sha256=IN8BLSXybByi85ZU1F2T-nTTLyxcnS3lN_DplpzC24A,2583
33
+ cwyodmodules/batch/utilities/helpers/azure_identity_helper.py,sha256=psYxgFhsl9U5W1KubfLis_2CC7HKYA3BUr17IFGXvFE,3101
34
34
  cwyodmodules/batch/utilities/helpers/azure_postgres_helper.py,sha256=RV2jcqFuTofbz1gk8CDYdECPgl_ypH3K84Yeu3kjU7o,10823
35
35
  cwyodmodules/batch/utilities/helpers/azure_postgres_helper_light_rag.py,sha256=DLgJ7KNK71qSUlRHTWgRgp6-4ufnC8frL_pOWE-oKgM,10915
36
36
  cwyodmodules/batch/utilities/helpers/azure_search_helper.py,sha256=vZk4u8uegDnBI_zgixtQgb8PWpptIA3zlOzNsvkvGfE,10401
@@ -108,8 +108,8 @@ cwyodmodules/graphrag/query/generate.py,sha256=xBnZs2U9xFWtPk4AfAZgYKbHdcxNcIO6Q
108
108
  cwyodmodules/graphrag/query/graph_search.py,sha256=95h3ecSWx4864XgKABtG0fh3Nk8HkqJVzoCrO8daJ-Y,7724
109
109
  cwyodmodules/graphrag/query/types.py,sha256=1Iq1dp4I4a56_cuFjOZ0NTgd0A2_MpVFznp_czgt6cI,617
110
110
  cwyodmodules/graphrag/query/vector_search.py,sha256=9Gwu9LPjtoAYUU8WKqCvbCHAIg3dpk71reoYd1scLnQ,1807
111
- cwyodmodules-0.3.28.dist-info/licenses/LICENSE,sha256=UqBDTipijsSW2ZSOXyTZnMsXmLoEHTgNEM0tL4g-Sso,1150
112
- cwyodmodules-0.3.28.dist-info/METADATA,sha256=2UOwmOhMeIJ-8rsAjWyAfAtmkFZDX5FB1rByafDA04w,1969
113
- cwyodmodules-0.3.28.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
114
- cwyodmodules-0.3.28.dist-info/top_level.txt,sha256=99RENLbkdRX-qpJvsxZ5AfmTL5s6shSaKOWYpz1vwzg,13
115
- cwyodmodules-0.3.28.dist-info/RECORD,,
111
+ cwyodmodules-0.3.29.dist-info/licenses/LICENSE,sha256=UqBDTipijsSW2ZSOXyTZnMsXmLoEHTgNEM0tL4g-Sso,1150
112
+ cwyodmodules-0.3.29.dist-info/METADATA,sha256=jCjAy1xp3dV5BBLOQPBkAfKHY-DRmonHQQB2Ymsi0vM,1969
113
+ cwyodmodules-0.3.29.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
114
+ cwyodmodules-0.3.29.dist-info/top_level.txt,sha256=99RENLbkdRX-qpJvsxZ5AfmTL5s6shSaKOWYpz1vwzg,13
115
+ cwyodmodules-0.3.29.dist-info/RECORD,,