Skip to content

Commit c3bc2ff

Browse files
committed
Implement a dummy deprecated() when ran on Python pre-3.13
1 parent 6a16585 commit c3bc2ff

File tree

2 files changed

+29
-19
lines changed

2 files changed

+29
-19
lines changed

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)