tagreader 5.0.0__tar.gz → 5.1.1__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.0.0
3
+ Version: 5.1.1
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
@@ -21,21 +21,16 @@ Classifier: Programming Language :: Python :: 3.8
21
21
  Classifier: Programming Language :: Python :: 3.9
22
22
  Classifier: Programming Language :: Python :: 3.10
23
23
  Classifier: Programming Language :: Python :: 3.11
24
- Classifier: Programming Language :: Python :: 3.10
25
- Classifier: Programming Language :: Python :: 3.11
26
- Classifier: Programming Language :: Python :: 3.8
27
- Classifier: Programming Language :: Python :: 3.9
24
+ Classifier: Programming Language :: Python :: 3.12
28
25
  Classifier: Topic :: Scientific/Engineering :: Interface Engine/Protocol Translator
29
26
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
30
27
  Classifier: Topic :: Utilities
31
28
  Provides-Extra: notebooks
32
29
  Requires-Dist: certifi (>=2023.7.22,<2024.0.0)
33
- Requires-Dist: cryptography (>=41.0.3,<42.0.0)
34
30
  Requires-Dist: diskcache (>=5.6.1,<6.0.0)
35
31
  Requires-Dist: matplotlib (>=3,<4) ; extra == "notebooks"
36
32
  Requires-Dist: notebook (>=7.0.3,<8.0.0) ; extra == "notebooks"
37
33
  Requires-Dist: pandas (>=1)
38
- Requires-Dist: pyodbc (>=4,<5)
39
34
  Requires-Dist: requests (>=2,<3)
40
35
  Requires-Dist: requests-kerberos (>=0,<1)
41
36
  Project-URL: Repository, https://github.com/equinor/tagreader-python
@@ -1,8 +1,8 @@
1
1
  [tool.poetry]
2
2
  name = "tagreader"
3
- version = "5.0.0"
3
+ version = "5.1.1"
4
4
  description = "Tagreader is a Python package for reading trend data from the OSIsoft PI and Aspen Infoplus.21 IMS systems."
5
- authors = ["Einar S. Idsø <eiids@equinor.com>"]
5
+ authors = ["Einar S. Idsø <eiids@equinor.com>", "Morten Dæhli Aslesen <masl@equinor.com"]
6
6
  license = "MIT"
7
7
  readme = "README.md"
8
8
  packages = [{include = "tagreader"}]
@@ -30,8 +30,6 @@ classifiers=[
30
30
  [tool.poetry.dependencies]
31
31
  python = "^3.8"
32
32
  pandas = ">=1"
33
- pyodbc = "^4"
34
- cryptography = "^41.0.3"
35
33
  certifi = "^2023.7.22"
36
34
  requests = "^2"
37
35
  requests-kerberos = "^0"
@@ -130,6 +130,10 @@ class ReaderType(enum.IntEnum):
130
130
 
131
131
 
132
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:
133
137
  """
134
138
  This is a utility function for Equinor employees on Equinor managed machines.
135
139
 
@@ -137,7 +141,8 @@ def add_statoil_root_certificate() -> bool:
137
141
  cert store and imports it to the cacert bundle. Does nothing if not
138
142
  running on Equinor host.
139
143
 
140
- This needs to be repeated after updating the cacert module.
144
+ NB! This needs to be repeated after updating the cacert module.
145
+ NB! Will not download certificates.
141
146
 
142
147
  Returns:
143
148
  bool: True if function completes successfully
@@ -148,6 +153,14 @@ def add_statoil_root_certificate() -> bool:
148
153
  import certifi
149
154
 
150
155
  STATOIL_ROOT_PEM_HASH = "ce7bb185ab908d2fea28c7d097841d9d5bbf2c76"
156
+ 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"
151
164
 
152
165
  found = False
153
166
  der = None
@@ -158,7 +171,7 @@ def add_statoil_root_certificate() -> bool:
158
171
  logger.debug("Scanning CA certificate in Windows cert store", end="")
159
172
  for cert in ssl.enum_certificates("CA"):
160
173
  der = cert[0]
161
- if hashlib.sha1(der).hexdigest() == STATOIL_ROOT_PEM_HASH:
174
+ if hashlib.sha1(der).hexdigest().upper() == used_hash:
162
175
  found = True
163
176
  logger.debug("CA certificate found!")
164
177
  break
@@ -166,14 +179,14 @@ def add_statoil_root_certificate() -> bool:
166
179
  import subprocess
167
180
 
168
181
  macos_ca_certs = subprocess.run(
169
- ["security", "find-certificate", "-a", "-c", "Statoil Root CA", "-Z"],
182
+ ["security", "find-certificate", "-a", "-c", ca_search, "-Z"],
170
183
  stdout=subprocess.PIPE,
171
184
  ).stdout
172
185
 
173
- if STATOIL_ROOT_PEM_HASH.upper() in str(macos_ca_certs).upper():
186
+ if used_hash in str(macos_ca_certs).upper():
174
187
  c = get_macos_equinor_certificates()
175
188
  for cert in c:
176
- if hashlib.sha1(cert).hexdigest() == STATOIL_ROOT_PEM_HASH:
189
+ if hashlib.sha1(cert).hexdigest().upper() == used_hash:
177
190
  der = cert
178
191
  found = True
179
192
  break
@@ -196,18 +209,24 @@ def add_statoil_root_certificate() -> bool:
196
209
  return found
197
210
 
198
211
 
199
- def get_macos_equinor_certificates():
212
+ def get_macos_equinor_certificates(get_equinor: bool = True):
200
213
  import ssl
201
214
  import tempfile
202
215
 
216
+ if get_equinor:
217
+ ca_search = "Equinor Root CA"
218
+ else:
219
+ ca_search = "Statoil Root CA"
220
+
203
221
  ctx = ssl.create_default_context()
204
222
  macos_ca_certs = subprocess.run(
205
- ["security", "find-certificate", "-a", "-c", "Statoil Root CA", "-p"],
223
+ ["security", "find-certificate", "-a", "-c", ca_search, "-p"],
206
224
  stdout=subprocess.PIPE,
207
225
  ).stdout
208
- with tempfile.NamedTemporaryFile("w+b") as tmp_file:
226
+ with tempfile.NamedTemporaryFile("w+b", delete=False) as tmp_file:
209
227
  tmp_file.write(macos_ca_certs)
210
- ctx.load_verify_locations(tmp_file.name)
228
+
229
+ ctx.load_verify_locations(tmp_file.name)
211
230
 
212
231
  return ctx.get_ca_certs(binary_form=True)
213
232
 
File without changes
File without changes
File without changes
File without changes