Skip to content

Commit 4613ea4

Browse files
committed
Implement a dummy function when ran on Python pre-3.13
1 parent 6a16585 commit 4613ea4

File tree

3 files changed

+30
-30
lines changed

3 files changed

+30
-30
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,6 @@ jobs:
1111
python-version: [3.9]
1212
splunk-version: [9.4, latest]
1313
include:
14-
# Oldest possible configuration
15-
# Last Ubuntu version with Python 3.7 binaries available
16-
- os: ubuntu-22.04
17-
python-version: 3.7
18-
splunk-version: 9.1
19-
# Latest possible configuration
2014
- os: ubuntu-latest
2115
python-version: 3.13
2216
splunk-version: latest
@@ -29,11 +23,7 @@ jobs:
2923
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405
3024
with:
3125
python-version: ${{ matrix.python-version }}
32-
- name: (Python 3.7) Install dependencies
33-
if: ${{ matrix.python-version == '3.7' }}
34-
run: python -m pip install python-dotenv pytest
35-
- name: (Python >= 3.9) Install dependencies
36-
if: ${{ matrix.python-version != '3.7' }}
26+
- name: Install dependencies
3727
run: python -m pip install . --group test
3828
- name: Run entire test suite
3929
run: python -m pytest ./tests

docker-compose.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ services:
22
splunk:
33
image: "splunk/splunk:${SPLUNK_VERSION}"
44
container_name: splunk
5+
platform: linux/amd64
56
environment:
67
- SPLUNK_START_ARGS=--accept-license
78
- SPLUNK_GENERAL_TERMS=--accept-sgt-current-at-splunk-com
@@ -13,7 +14,7 @@ services:
1314
- "8088:8088"
1415
- "8089:8089"
1516
healthcheck:
16-
test: ['CMD', 'curl', '-f', 'http://localhost:8000']
17+
test: ["CMD", "curl", "-f", "http://localhost:8000"]
1718
interval: 5s
1819
timeout: 5s
1920
retries: 20

splunklib/client.py

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,6 @@
1111
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
1212
# License for the specific language governing permissions and limitations
1313
# under the License.
14-
#
15-
# The purpose of this module is to provide a friendlier domain interface to
16-
# various Splunk endpoints. The approach here is to leverage the binding
17-
# layer to capture endpoint context and provide objects and methods that
18-
# offer simplified access their corresponding endpoints. The design avoids
19-
# caching resource state. From the perspective of this module, the 'policy'
20-
# for caching resource state belongs in the application or a higher level
21-
# framework, and its the purpose of this module to provide simplified
22-
# access to that resource state.
23-
#
24-
# A side note, the objects below that provide helper methods for updating eg:
25-
# Entity state, are written so that they may be used in a fluent style.
26-
#
2714

2815
"""The **splunklib.client** module provides a Pythonic interface to the
2916
`Splunk REST API <http://docs.splunk.com/Documentation/Splunk/latest/RESTAPI/RESTcontents>`_,
@@ -56,10 +43,21 @@
5643
5744
print(my_app['author']) # Or: print(my_app.author)
5845
my_app.package() # Creates a compressed package of this application
46+
47+
The purpose of this module is to provide a friendlier domain interface to
48+
various Splunk endpoints. The approach here is to leverage the binding
49+
layer to capture endpoint context and provide objects and methods that
50+
offer simplified access their corresponding endpoints. The design avoids
51+
caching resource state. From the perspective of this module, the 'policy'
52+
for caching resource state belongs in the application or a higher level
53+
framework, and its the purpose of this module to provide simplified
54+
access to that resource state.
55+
56+
A side note, the objects below that provide helper methods for updating eg:
57+
Entity state, are written so that they may be used in a fluent style.
5958
"""
6059

6160
import contextlib
62-
import datetime
6361
import json
6462
import logging
6563
import re
@@ -68,8 +66,15 @@
6866
from time import sleep
6967
from urllib import parse
7068

69+
try:
70+
from warnings import deprecated
71+
except ImportError:
72+
73+
def deprecated(message): # pyright: ignore[reportUnknownParameterType]
74+
return lambda _msg: None
75+
76+
7177
from . import data
72-
from .data import record
7378
from .binding import (
7479
AuthenticationError,
7580
Context,
@@ -80,17 +85,18 @@
8085
_NoAuthenticationToken,
8186
namespace,
8287
)
88+
from .data import record
8389

8490
logger = logging.getLogger(__name__)
8591

8692
__all__ = [
87-
"connect",
93+
"AuthenticationError",
94+
"IncomparableException",
8895
"NotSupportedError",
8996
"OperationError",
90-
"IncomparableException",
9197
"Service",
98+
"connect",
9299
"namespace",
93-
"AuthenticationError",
94100
]
95101

96102
PATH_APPS = "apps/local/"
@@ -2007,6 +2013,9 @@ def clear_password(self):
20072013
return self.content.get("clear_password")
20082014

20092015
@property
2016+
@deprecated(
2017+
"To improve security, this field now returns an empty string and will be removed from Splunk in a future release.",
2018+
)
20102019
def encrypted_password(self):
20112020
return self.content.get("encr_password")
20122021

0 commit comments

Comments
 (0)