Skip to content

Commit c81ed88

Browse files
chore: merge develop into main (#428)
release 6.2
2 parents 4276e5e + 1ad1ec8 commit c81ed88

File tree

4 files changed

+55
-4
lines changed

4 files changed

+55
-4
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
[tool.poetry]
1818
name = "solnlib"
19-
version = "6.1.0"
19+
version = "6.2.0-beta.1"
2020
description = "The Splunk Software Development Kit for Splunk Solutions"
2121
authors = ["Splunk <addonfactory@splunk.com>"]
2222
license = "Apache-2.0"

solnlib/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,4 @@
5656
"utils",
5757
]
5858

59-
__version__ = "6.1.0"
59+
__version__ = "6.2.0-beta.1"

solnlib/splunk_rest_client.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,13 @@
2323

2424
import logging
2525
import os
26+
import sys
2627
import traceback
28+
import solnlib
29+
2730
from io import BytesIO
2831
from urllib.parse import quote
2932
from urllib3.util.retry import Retry
30-
3133
from splunklib import binding, client
3234

3335
from .net_utils import validate_scheme_host_port
@@ -134,7 +136,7 @@ def request(url, message, **kwargs):
134136

135137
body = message.get("body")
136138
headers = {
137-
"User-Agent": "curl",
139+
"User-Agent": f"solnlib/{solnlib.__version__} rest-client {sys.platform}",
138140
"Accept": "*/*",
139141
"Connection": "Keep-Alive",
140142
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#
2+
# Copyright 2025 Splunk Inc.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
import context
18+
import pytest
19+
import solnlib
20+
from time import sleep
21+
from splunklib import binding
22+
from solnlib import splunk_rest_client as rest_client
23+
24+
from _search import search
25+
26+
27+
def test_rest_client_user_agent():
28+
test_url = r'search index = _internal uri_path="*/servicesNS/nobody/test_app/some/unexisting/url"'
29+
user_agent = f"solnlib/{solnlib.__version__} rest-client linux"
30+
session_key = context.get_session_key()
31+
wrong_url = r"some/unexisting/url"
32+
rc = rest_client.SplunkRestClient(
33+
session_key,
34+
app="test_app",
35+
owner=context.owner,
36+
scheme=context.scheme,
37+
host=context.host,
38+
port=context.port,
39+
)
40+
with pytest.raises(binding.HTTPError):
41+
rc.get(wrong_url)
42+
43+
for i in range(50):
44+
search_results = search(session_key, test_url)
45+
if len(search_results) > 0:
46+
break
47+
sleep(0.5)
48+
49+
assert user_agent in search_results[0]["_raw"]

0 commit comments

Comments
 (0)