tagreader 5.3.0__tar.gz → 5.4.0__tar.gz

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,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tagreader
3
- Version: 5.3.0
3
+ Version: 5.4.0
4
4
  Summary: Tagreader is a Python package for reading trend data from the OSIsoft PI and Aspen Infoplus.21 IMS systems.
5
5
  Home-page: https://github.com/equinor/tagreader-python
6
6
  License: MIT
@@ -29,7 +29,7 @@ Provides-Extra: notebooks
29
29
  Requires-Dist: certifi (>=2023.7.22,<2024.0.0)
30
30
  Requires-Dist: diskcache (>=5.6.1,<6.0.0)
31
31
  Requires-Dist: matplotlib (>=3,<4) ; extra == "notebooks"
32
- Requires-Dist: msal-bearer (>=0.2.1,<0.3.0)
32
+ Requires-Dist: msal-bearer (>=0.2.1,<1.1.0)
33
33
  Requires-Dist: notebook (>=7.0.3,<8.0.0) ; extra == "notebooks"
34
34
  Requires-Dist: pandas (>=1)
35
35
  Requires-Dist: pycryptodome (>=3.20.0,<4.0.0)
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "tagreader"
3
- version = "5.3.0"
3
+ version = "5.4.0"
4
4
  description = "Tagreader is a Python package for reading trend data from the OSIsoft PI and Aspen Infoplus.21 IMS systems."
5
5
  authors = ["Einar S. Idsø <eiids@equinor.com>", "Morten Dæhli Aslesen <masl@equinor.com"]
6
6
  license = "MIT"
@@ -33,7 +33,7 @@ pandas = ">=1"
33
33
  certifi = "^2023.7.22"
34
34
  requests = "^2"
35
35
  requests-kerberos = "^0"
36
- msal-bearer = "^0.2.1"
36
+ msal-bearer = ">=0.2.1,<1.1.0"
37
37
  notebook = { version = "^7.0.3", optional = true }
38
38
  matplotlib = { version = "^3", optional = true }
39
39
  diskcache = "^5.6.1"
@@ -43,7 +43,7 @@ requests-ntlm = ">=1.1,<=2.0"
43
43
 
44
44
  [tool.poetry.group.dev.dependencies]
45
45
  pre-commit = "^3"
46
- pytest = "^7"
46
+ pytest = ">=7,<9"
47
47
 
48
48
  [tool.poetry.extras]
49
49
  notebooks = ["notebook", "matplotlib"]
@@ -2,13 +2,13 @@ from tagreader.clients import IMSClient, list_sources
2
2
  from tagreader.utils import (
3
3
  IMSType,
4
4
  ReaderType,
5
- add_statoil_root_certificate,
5
+ add_equinor_root_certificate,
6
6
  is_equinor,
7
7
  is_mac,
8
8
  is_windows,
9
9
  )
10
10
 
11
11
  if is_equinor():
12
- add_statoil_root_certificate()
12
+ add_equinor_root_certificate()
13
13
 
14
14
  from tagreader.__version__ import version as __version__
@@ -129,11 +129,7 @@ class ReaderType(enum.IntEnum):
129
129
  SNAPSHOT = FINAL = LAST = enum.auto() # Last sampled value
130
130
 
131
131
 
132
- def add_statoil_root_certificate() -> bool:
133
- return add_equinor_root_certificate(True) and add_equinor_root_certificate(False)
134
-
135
-
136
- def add_equinor_root_certificate(get_equinor: bool = True) -> bool:
132
+ def add_equinor_root_certificate() -> bool:
137
133
  """
138
134
  This is a utility function for Equinor employees on Equinor managed machines.
139
135
 
@@ -152,15 +148,8 @@ def add_equinor_root_certificate(get_equinor: bool = True) -> bool:
152
148
 
153
149
  import certifi
154
150
 
155
- STATOIL_ROOT_PEM_HASH = "ce7bb185ab908d2fea28c7d097841d9d5bbf2c76"
156
151
  EQUINOR_root_PEM_HASH = "5A206332CE73CED1D44C8A99C4C43B7CEE03DF5F"
157
-
158
- if get_equinor:
159
- used_hash = EQUINOR_root_PEM_HASH.upper()
160
- ca_search = "Equinor Root CA"
161
- else:
162
- used_hash = STATOIL_ROOT_PEM_HASH.upper()
163
- ca_search = "Statoil Root CA"
152
+ ca_search = "Equinor Root CA"
164
153
 
165
154
  found = False
166
155
  der = None
@@ -172,7 +161,7 @@ def add_equinor_root_certificate(get_equinor: bool = True) -> bool:
172
161
  for cert in ssl.enum_certificates("CA"):
173
162
  der = cert[0]
174
163
  # deepcode ignore InsecureHash: <Only hashes to compare with known hash>
175
- if hashlib.sha1(der).hexdigest().upper() == used_hash:
164
+ if hashlib.sha1(der).hexdigest().upper() == EQUINOR_root_PEM_HASH:
176
165
  found = True
177
166
  logger.debug("CA certificate found!")
178
167
  break
@@ -182,11 +171,11 @@ def add_equinor_root_certificate(get_equinor: bool = True) -> bool:
182
171
  stdout=subprocess.PIPE,
183
172
  ).stdout
184
173
 
185
- if used_hash in str(macos_ca_certs).upper():
174
+ if EQUINOR_root_PEM_HASH in str(macos_ca_certs).upper():
186
175
  c = get_macos_equinor_certificates()
187
176
  for cert in c:
188
177
  # deepcode ignore InsecureHash: <Only hashes to compare with known hash>
189
- if hashlib.sha1(cert).hexdigest().upper() == used_hash:
178
+ if hashlib.sha1(cert).hexdigest().upper() == EQUINOR_root_PEM_HASH:
190
179
  der = cert
191
180
  found = True
192
181
  break
@@ -209,14 +198,11 @@ def add_equinor_root_certificate(get_equinor: bool = True) -> bool:
209
198
  return found
210
199
 
211
200
 
212
- def get_macos_equinor_certificates(get_equinor: bool = True):
201
+ def get_macos_equinor_certificates():
213
202
  import ssl
214
203
  import tempfile
215
204
 
216
- if get_equinor:
217
- ca_search = "Equinor Root CA"
218
- else:
219
- ca_search = "Statoil Root CA"
205
+ ca_search = "Equinor Root CA"
220
206
 
221
207
  ctx = ssl.create_default_context()
222
208
  macos_ca_certs = subprocess.run(
@@ -523,11 +523,13 @@ class AspenHandlerWeb(BaseHandlerWeb):
523
523
  def _get_tag_description(self, tag: str):
524
524
  query = self.generate_get_description_query(tag)
525
525
  url = urljoin(self.base_url, "TagInfo")
526
- data = self.fetch(url, params=query)
527
526
  try:
527
+ data = self.fetch(url, params=query)
528
528
  desc = data["data"]["tags"][0]["attrData"][0]["samples"][0]["v"]
529
529
  except KeyError:
530
530
  desc = ""
531
+ except JSONDecodeError:
532
+ desc = ""
531
533
  return desc
532
534
 
533
535
  def read_tag(
File without changes
File without changes
File without changes
File without changes