cognite-extractor-utils 7.5.10__py3-none-any.whl → 7.5.12__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.12"
20
20
  from .base import Extractor
21
21
 
22
22
  __all__ = ["Extractor"]
@@ -90,6 +90,7 @@ class Extractor(Generic[CustomConfigClass]):
90
90
  handle_interrupts: bool = True,
91
91
  reload_config_interval: int | None = 300,
92
92
  reload_config_action: ReloadConfigAction = ReloadConfigAction.DO_NOTHING,
93
+ success_message: str = "Successful shutdown",
93
94
  ):
94
95
  self.name = name
95
96
  self.description = description
@@ -104,6 +105,7 @@ class Extractor(Generic[CustomConfigClass]):
104
105
  self.handle_interrupts = handle_interrupts
105
106
  self.reload_config_interval = reload_config_interval
106
107
  self.reload_config_action = reload_config_action
108
+ self.success_message = success_message
107
109
 
108
110
  self.started = False
109
111
  self.configured_logger = False
@@ -218,7 +220,7 @@ class Extractor(Generic[CustomConfigClass]):
218
220
  ExtractionPipelineRun(
219
221
  extpipe_external_id=self.extraction_pipeline.external_id,
220
222
  status="success",
221
- message="Successful shutdown",
223
+ message=self.success_message,
222
224
  )
223
225
  )
224
226
 
@@ -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"]
@@ -72,7 +72,7 @@ def default_time_series_factory(external_id: str, datapoints: DataPointList) ->
72
72
  A TimeSeries object with external_id set, and the is_string automatically detected
73
73
  """
74
74
  is_string = (
75
- isinstance(datapoints[0].get("value"), str) # type: ignore # input might be dict to keep compatibility
75
+ isinstance(datapoints[0].get("value"), str)
76
76
  if isinstance(datapoints[0], dict)
77
77
  else isinstance(datapoints[0][1], str)
78
78
  )
@@ -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.12
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>
@@ -72,15 +72,6 @@ project, and then set up a poetry environment, git repository, commit hooks with
72
72
  template.
73
73
 
74
74
 
75
- ### Extensions
76
-
77
- Some source systems have a lot in common, such as RESTful APIs or systems exposing as MQTT. We therefore have extensions
78
- to `extractor-utils` tailroed to these protocols. These can be found in separate packages:
79
-
80
- * [REST extension](https://github.com/cognitedata/python-extractor-utils-rest)
81
- * [MQTT extension](https://github.com/cognitedata/python-extractor-utils-mqtt)
82
-
83
-
84
75
  ## Contributing
85
76
 
86
77
  The package is open source under the [Apache 2.0 license](./LICENSE), and contribtuions are welcome.
@@ -1,6 +1,6 @@
1
- cognite/extractorutils/__init__.py,sha256=PPeqjI1OnpB1kdKnuKjHukkj9BauAO6kJHugrm8GbH4,765
1
+ cognite/extractorutils/__init__.py,sha256=_uW4et3n6Sh-nX8s8o8Okl7SK5Iicg6ZZOKBCWdEnhw,765
2
2
  cognite/extractorutils/_inner_util.py,sha256=ZMZIBwFpSD39RzLZq_OJlrFtVt8NFOtU4ObzAG8vTB4,1779
3
- cognite/extractorutils/base.py,sha256=-jkGgUMYKdhFReua8ZoGUQwT1qbOvg6nTrt0lyJOGVc,16354
3
+ cognite/extractorutils/base.py,sha256=QeJJfufp13waxlUikptMNHeQLHpBY1TZ3lYsA_rO__E,16454
4
4
  cognite/extractorutils/exceptions.py,sha256=4qreRiTwZH9lyLIKR67TP02MUxN9oYhCd2vFTb5bRME,1125
5
5
  cognite/extractorutils/metrics.py,sha256=dBxtfJkTWcVbVpqM5VYmP4U3cO7iultz7k036Um4Tx0,15406
6
6
  cognite/extractorutils/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -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
@@ -42,9 +42,9 @@ cognite/extractorutils/uploader/data_modeling.py,sha256=h4uRnppU2dVBquJz0Uy2SKNy
42
42
  cognite/extractorutils/uploader/events.py,sha256=soU8TslPFIA7Ck4ATR_a7MHGitztRcn0cEt7LIbMPsE,5643
43
43
  cognite/extractorutils/uploader/files.py,sha256=ag3TUrImJdAUiOSXugagD03-9WGlFpIyd31z3WMJU20,27180
44
44
  cognite/extractorutils/uploader/raw.py,sha256=8duMk9uVJPK3O6C0nzwnvrl0UzBtJs_T_L1la0Vo89k,6713
45
- cognite/extractorutils/uploader/time_series.py,sha256=rs-jEChEZymxc98TYePpSRstPjQnDJd97vjOEYc-0-A,26568
45
+ cognite/extractorutils/uploader/time_series.py,sha256=3HaKfWcSOTKFmB6VwpRwioOykkRa6qmruSSsZu8Njdk,26507
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.12.dist-info/METADATA,sha256=R1sEQCVzrdz5z2MvinBnCI2ycWs_4FtsGofEEg-KC8g,4889
48
+ cognite_extractor_utils-7.5.12.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
49
+ cognite_extractor_utils-7.5.12.dist-info/licenses/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
50
+ cognite_extractor_utils-7.5.12.dist-info/RECORD,,