Skip to content

Commit 9f14932

Browse files
author
Richard Bell
committed
Merge remote-tracking branch 'origin/master' into users/rbell/query-steps-perf
2 parents e9722d8 + f8063f9 commit 9f14932

File tree

17 files changed

+247
-52
lines changed

17 files changed

+247
-52
lines changed

CHANGELOG.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,34 @@
22

33
<!--next-version-placeholder-->
44

5+
## v2.8.0 (2025-03-26)
6+
7+
### Feature
8+
9+
* Update TestMonitorClient, ProductClient, and SpecsClient with retry handling ([#124](https://github.com/ni/nisystemlink-clients-python/issues/124)) ([`4714ec1`](https://github.com/ni/nisystemlink-clients-python/commit/4714ec139fbc224263c392286383895100c86583))
10+
11+
### Fix
12+
13+
* Make condition type optional while querying specs ([#123](https://github.com/ni/nisystemlink-clients-python/issues/123)) ([`9d0d923`](https://github.com/ni/nisystemlink-clients-python/commit/9d0d9239bc769801590ba8a507c0e3cd5f87e12d))
14+
15+
## v2.7.4 (2025-03-25)
16+
17+
### Fix
18+
19+
* Handle none values and column grouping in results/steps dataframe utility ([#119](https://github.com/ni/nisystemlink-clients-python/issues/119)) ([`9eb2087`](https://github.com/ni/nisystemlink-clients-python/commit/9eb20876ffc4bfc02ce5b4712b65a56085b70029))
20+
21+
## v2.7.3 (2025-03-24)
22+
23+
### Fix
24+
25+
* Make testmonitor step examples show up in docs and fix `update_results` example ([#120](https://github.com/ni/nisystemlink-clients-python/issues/120)) ([`dacfdfb`](https://github.com/ni/nisystemlink-clients-python/commit/dacfdfb6864473fd935986edc8d2562df1e28f9a))
26+
27+
## v2.7.2 (2025-03-21)
28+
29+
### Fix
30+
31+
* Error in converting results/steps to dataframe when status is none ([#115](https://github.com/ni/nisystemlink-clients-python/issues/115)) ([`e67d935`](https://github.com/ni/nisystemlink-clients-python/commit/e67d935586f7d2e58c49b865bd8cc3c0d74ead08))
32+
533
## v2.7.1 (2025-03-19)
634

735
### Fix

docs/getting_started.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ Create, update, query, and delete steps
286286

287287
.. literalinclude:: ../examples/testmonitor/steps.py
288288
:language: python
289-
:linenos
289+
:linenos:
290290

291291
Notebook API
292292
-------
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
"""Example to demonstrate disabling TLS/SSL certificate verification for connections"""
2+
3+
from nisystemlink.clients.core import HttpConfigurationManager
4+
from nisystemlink.clients.file import FileClient
5+
6+
# explicitly get the http config and set the verify option
7+
http_config = HttpConfigurationManager.get_configuration()
8+
http_config.verify = False
9+
10+
client = FileClient(configuration=http_config)
11+
print(client.api_info())

examples/testmonitor/results.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
ResultField,
77
Status,
88
StatusType,
9+
UpdateResultRequest,
910
)
1011

1112
program_name = "Example Name"
@@ -70,9 +71,12 @@ def create_some_results():
7071

7172
# Update the first result that you just created and replace the keywords
7273
updated_result = create_response.results[0]
73-
updated_result.keywords = ["new keyword"]
74-
updated_result.properties = {"new property key": "new value"}
75-
update_response = client.update_results([create_response.results[0]], replace=True)
74+
updated_result = UpdateResultRequest(
75+
id=create_response.results[0].id,
76+
keywords=["new keyword"],
77+
properties={"new property key": "new value"},
78+
)
79+
update_response = client.update_results([updated_result], replace=True)
7680

7781
# Query for just the ids of results that match the family
7882
values_query = QueryResultValuesRequest(

nisystemlink/clients/core/_http_configuration.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ def __init__(
2323
password: Optional[str] = None,
2424
cert_path: Optional[pathlib.Path] = None,
2525
workspace: Optional[str] = None,
26+
verify: bool = True,
2627
) -> None:
2728
"""Initialize a configuration.
2829
@@ -40,6 +41,7 @@ def __init__(
4041
password: The user's password to use when authorization is required.
4142
cert_path: Local path to an SSL certificate file.
4243
workspace: ID of workspace to use for client operations.
44+
verify: Verify the security certificate for connection
4345
4446
Raises:
4547
ValueError: if ``server_uri`` is missing scheme or host information.
@@ -73,6 +75,17 @@ def __init__(
7375

7476
self._workspace = workspace
7577

78+
self._verify = verify
79+
80+
@property
81+
def verify(self) -> bool:
82+
"""Verify the security certificate for connection."""
83+
return self._verify
84+
85+
@verify.setter
86+
def verify(self, value: bool) -> None:
87+
self._verify = value
88+
7689
@property
7790
def timeout_milliseconds(self) -> int: # noqa: D401
7891
"""The number of milliseconds before a request times out with an error.

nisystemlink/clients/core/_uplink/_base_client.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from json import loads
44
from typing import Any, Callable, Dict, List, get_origin, Optional, Type, Union
55

6+
import requests
67
from nisystemlink.clients import core
78
from pydantic import TypeAdapter
89
from requests import JSONDecodeError, Response
@@ -93,10 +94,14 @@ def __init__(self, configuration: core.HttpConfiguration, base_path: str = ""):
9394
configuration: Defines the web server to connect to and information about how to connect.
9495
base_path: The base path for all API calls.
9596
"""
97+
session = requests.Session()
98+
session.verify = configuration.verify
99+
96100
super().__init__(
97101
base_url=configuration.server_uri + base_path,
98102
converter=_JsonModelConverter(),
99103
hooks=[_handle_http_status],
104+
client=session,
100105
)
101106
if configuration.api_keys:
102107
self.session.headers.update(configuration.api_keys)

nisystemlink/clients/product/_product_client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111

1212

1313
@retry(
14-
when=retry.when.status([408, 429, 502, 503, 504]), stop=retry.stop.after_attempt(5)
14+
when=retry.when.status([408, 429, 502, 503, 504]),
15+
stop=retry.stop.after_attempt(5),
16+
on_exception=retry.CONNECTION_ERROR,
1517
)
1618
class ProductClient(BaseClient):
1719
def __init__(self, configuration: Optional[core.HttpConfiguration] = None):

nisystemlink/clients/spec/_spec_client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111

1212

1313
@retry(
14-
when=retry.when.status([408, 429, 502, 503, 504]), stop=retry.stop.after_attempt(5)
14+
when=retry.when.status([408, 429, 502, 503, 504]),
15+
stop=retry.stop.after_attempt(5),
16+
on_exception=retry.CONNECTION_ERROR,
1517
)
1618
class SpecClient(BaseClient):
1719
def __init__(self, configuration: Optional[core.HttpConfiguration] = None):

nisystemlink/clients/spec/models/_condition.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class ConditionRange(JsonModel):
3030
class ConditionValueBase(JsonModel):
3131
"""The base type for conditions that can be represented in several styles."""
3232

33-
condition_type: ConditionType
33+
condition_type: Optional[ConditionType]
3434
"""Type of the Condition."""
3535

3636

nisystemlink/clients/testmonitor/_test_monitor_client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515

1616

1717
@retry(
18-
when=retry.when.status([408, 429, 502, 503, 504]), stop=retry.stop.after_attempt(5)
18+
when=retry.when.status([408, 429, 502, 503, 504]),
19+
stop=retry.stop.after_attempt(5),
20+
on_exception=retry.CONNECTION_ERROR,
1921
)
2022
class TestMonitorClient(BaseClient):
2123
# prevent pytest from thinking this is a test class

0 commit comments

Comments
 (0)