cognite-extractor-utils 7.5.10__py3-none-any.whl → 7.5.11__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.

Potentially problematic release.


This version of cognite-extractor-utils might be problematic. Click here for more details.

@@ -16,7 +16,7 @@
16
16
  Cognite extractor utils is a Python package that simplifies the development of new extractors.
17
17
  """
18
18
 
19
- __version__ = "7.5.10"
19
+ __version__ = "7.5.11"
20
20
  from .base import Extractor
21
21
 
22
22
  __all__ = ["Extractor"]
@@ -1,3 +1,4 @@
1
+ import os
1
2
  import re
2
3
  from datetime import timedelta
3
4
  from enum import Enum
@@ -215,6 +216,36 @@ class ConnectionConfig(ConfigModel):
215
216
 
216
217
  return CogniteClient(client_config)
217
218
 
219
+ @classmethod
220
+ def from_environment(cls) -> "ConnectionConfig":
221
+ auth: AuthenticationConfig
222
+ if "COGNITE_CLIENT_SECRET" in os.environ:
223
+ auth = _ClientCredentialsConfig(
224
+ type="client-credentials",
225
+ client_id=os.environ["COGNITE_CLIENT_ID"],
226
+ client_secret=os.environ["COGNITE_CLIENT_SECRET"],
227
+ token_url=os.environ["COGNITE_TOKEN_URL"],
228
+ scopes=os.environ["COGNITE_TOKEN_SCOPES"].split(","),
229
+ )
230
+ elif "COGNITE_CLIENT_CERTIFICATE_PATH" in os.environ:
231
+ auth = _ClientCertificateConfig(
232
+ type="client-certificate",
233
+ client_id=os.environ["COGNITE_CLIENT_ID"],
234
+ path=Path(os.environ["COGNITE_CLIENT_CERTIFICATE_PATH"]),
235
+ password=os.environ.get("COGNITE_CLIENT_CERTIFICATE_PATH"),
236
+ authority_url=os.environ["COGNITE_AUTHORITY_URL"],
237
+ scopes=os.environ["COGNITE_TOKEN_SCOPES"].split(","),
238
+ )
239
+ else:
240
+ raise KeyError("Missing auth, either COGNITE_CLIENT_SECRET or COGNITE_CLIENT_CERTIFICATE_PATH must be set")
241
+
242
+ return ConnectionConfig(
243
+ project=os.environ["COGNITE_PROJECT"],
244
+ base_url=os.environ["COGNITE_BASE_URL"],
245
+ integration=os.environ["COGNITE_INTEGRATION"],
246
+ authentication=auth,
247
+ )
248
+
218
249
 
219
250
  class CronConfig(ConfigModel):
220
251
  type: Literal["cron"]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cognite-extractor-utils
3
- Version: 7.5.10
3
+ Version: 7.5.11
4
4
  Summary: Utilities for easier development of extractors for CDF
5
5
  Project-URL: repository, https://github.com/cognitedata/python-extractor-utils
6
6
  Author-email: Mathias Lohne <mathias.lohne@cognite.com>
@@ -1,4 +1,4 @@
1
- cognite/extractorutils/__init__.py,sha256=PPeqjI1OnpB1kdKnuKjHukkj9BauAO6kJHugrm8GbH4,765
1
+ cognite/extractorutils/__init__.py,sha256=QMrJrW8mM_pXGYl31dhRBsnmCVY7HtLNYMUG_X-BvLw,765
2
2
  cognite/extractorutils/_inner_util.py,sha256=ZMZIBwFpSD39RzLZq_OJlrFtVt8NFOtU4ObzAG8vTB4,1779
3
3
  cognite/extractorutils/base.py,sha256=-jkGgUMYKdhFReua8ZoGUQwT1qbOvg6nTrt0lyJOGVc,16354
4
4
  cognite/extractorutils/exceptions.py,sha256=4qreRiTwZH9lyLIKR67TP02MUxN9oYhCd2vFTb5bRME,1125
@@ -21,7 +21,7 @@ cognite/extractorutils/unstable/__init__.py,sha256=L6nqJHjylpk67CE-PbXJyb_TBI4yj
21
21
  cognite/extractorutils/unstable/configuration/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
22
  cognite/extractorutils/unstable/configuration/exceptions.py,sha256=2-0jUp9IFwzk2QTQzWLoGgW1KOApk9UmPmLwtwRUBaE,591
23
23
  cognite/extractorutils/unstable/configuration/loaders.py,sha256=guBSVz7nd3dfsNEfPEHUUmU5WoYdPQmBBaJk2FuKXVw,3640
24
- cognite/extractorutils/unstable/configuration/models.py,sha256=vrwe53CZroujNVVpgQbmZEOywtR8PMJ0exi9gBjc5Gw,8160
24
+ cognite/extractorutils/unstable/configuration/models.py,sha256=YYGXxSwct04J9A6NDlW0kpKHvlvtPxuLeMHgq5KwH-g,9567
25
25
  cognite/extractorutils/unstable/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
26
26
  cognite/extractorutils/unstable/core/_dto.py,sha256=tvvy39cvf-QT28GWz5FpqxQ5vAVk0t69JoPPhpWlweY,1293
27
27
  cognite/extractorutils/unstable/core/_messaging.py,sha256=D9rOW8fijryXffbm90d8VTf2vy5FmwVGU-H0O-cn-EI,68
@@ -44,7 +44,7 @@ cognite/extractorutils/uploader/files.py,sha256=ag3TUrImJdAUiOSXugagD03-9WGlFpIy
44
44
  cognite/extractorutils/uploader/raw.py,sha256=8duMk9uVJPK3O6C0nzwnvrl0UzBtJs_T_L1la0Vo89k,6713
45
45
  cognite/extractorutils/uploader/time_series.py,sha256=rs-jEChEZymxc98TYePpSRstPjQnDJd97vjOEYc-0-A,26568
46
46
  cognite/extractorutils/uploader/upload_failure_handler.py,sha256=wbUSXUP26rbmK2NGdQMzcWQwNOh2sXYOnlj0A_sk1n8,2003
47
- cognite_extractor_utils-7.5.10.dist-info/METADATA,sha256=cSWsbtpDLUv9uUtC_9lLcuBwv1oBW_3XiDVIXXOSFyo,5280
48
- cognite_extractor_utils-7.5.10.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
49
- cognite_extractor_utils-7.5.10.dist-info/licenses/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
50
- cognite_extractor_utils-7.5.10.dist-info/RECORD,,
47
+ cognite_extractor_utils-7.5.11.dist-info/METADATA,sha256=Ywvqxw4d9cEHRmAzbjjiNwdAmgb2FB2mxpo9XhLmGBE,5280
48
+ cognite_extractor_utils-7.5.11.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
49
+ cognite_extractor_utils-7.5.11.dist-info/licenses/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
50
+ cognite_extractor_utils-7.5.11.dist-info/RECORD,,