Skip to content

Commit 426c89b

Browse files
committed
Mark NoAuthenticationToken as SDK-private.
1 parent c288ca4 commit 426c89b

File tree

3 files changed

+7
-12
lines changed

3 files changed

+7
-12
lines changed

docs/binding.rst

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,5 @@ splunklib.binding
2121
.. autoclass:: HttpLib
2222
:members: delete, get, post, request
2323

24-
.. autoclass:: NoAuthenticationToken
25-
:members:
26-
2724
.. autoclass:: ResponseReader
2825
:members: close, empty, peek, read

docs/index.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ For more information about the SDK, see the `Splunk Developer Portal <http://dev
2222

2323
:class:`~splunklib.binding.AuthenticationError` class
2424

25-
:class:`~splunklib.binding.NoAuthenticationToken` class
26-
2725
**Custom HTTP handler**
2826

2927
:class:`~splunklib.binding.HTTPError` class

splunklib/binding.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,14 @@ class AuthenticationError(Exception):
7474
pass
7575

7676
# Singleton values to eschew None
77-
class NoAuthenticationToken(object):
77+
class _NoAuthenticationToken(object):
7878
"""The value stored in a :class:`Context` or :class:`splunklib.client.Service`
7979
class that is not logged in.
8080
8181
If a ``Context`` or ``Service`` object is created without an authentication
8282
token, and there has not yet been a call to the ``login`` method, the token
8383
field of the ``Context`` or ``Service`` object is set to
84-
``NoAuthenticationToken``.
84+
``_NoAuthenticationToken``.
8585
8686
Likewise, after a ``Context`` or ``Service`` object has been logged out, the
8787
token is set to this value again.
@@ -227,7 +227,7 @@ def f():
227227
"""
228228
@wraps(request_fun)
229229
def wrapper(self, *args, **kwargs):
230-
if self.token is NoAuthenticationToken:
230+
if self.token is _NoAuthenticationToken:
231231
# Not yet logged in.
232232
if self.autologin and self.username and self.password:
233233
# This will throw an uncaught
@@ -403,9 +403,9 @@ class Context(object):
403403
"""
404404
def __init__(self, handler=None, **kwargs):
405405
self.http = HttpLib(handler)
406-
self.token = kwargs.get("token", NoAuthenticationToken)
406+
self.token = kwargs.get("token", _NoAuthenticationToken)
407407
if self.token is None: # In case someone explicitly passes token=None
408-
self.token = NoAuthenticationToken
408+
self.token = _NoAuthenticationToken
409409
self.scheme = kwargs.get("scheme", DEFAULT_SCHEME)
410410
self.host = kwargs.get("host", DEFAULT_HOST)
411411
self.port = int(kwargs.get("port", DEFAULT_PORT))
@@ -742,7 +742,7 @@ def login(self):
742742
c = binding.Context(...).login()
743743
# Then issue requests...
744744
"""
745-
if self.token is not NoAuthenticationToken and \
745+
if self.token is not _NoAuthenticationToken and \
746746
(not self.username and not self.password):
747747
# If we were passed a session token, but no username or
748748
# password, then login is a nop, since we're automatically
@@ -765,7 +765,7 @@ def login(self):
765765

766766
def logout(self):
767767
"""Forgets the current session token."""
768-
self.token = NoAuthenticationToken
768+
self.token = _NoAuthenticationToken
769769
return self
770770

771771
def _abspath(self, path_segment,

0 commit comments

Comments
 (0)