Skip to content

Commit c3884e5

Browse files
authored
API docs: improve ExpiringAuth docs (#934)
* Docs: mention changes made to ExpiringAuth in 5.9.0 * Make docs render ExpiringAuth with all members
1 parent c95dc3a commit c3884e5

File tree

2 files changed

+20
-9
lines changed

2 files changed

+20
-9
lines changed

docs/source/api.rst

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -111,23 +111,26 @@ The auth token is an object of the class :class:`neo4j.Auth` containing static d
111111

112112
.. autoclass:: neo4j.Auth
113113

114+
Example:
115+
116+
.. code-block:: python
117+
118+
import neo4j
119+
120+
121+
auth = neo4j.Auth("basic", "neo4j", "password")
122+
123+
114124
.. autoclass:: neo4j.auth_management.AuthManager
115125
:members:
116126

117127
.. autoclass:: neo4j.auth_management.AuthManagers
118128
:members:
119129

120130
.. autoclass:: neo4j.auth_management.ExpiringAuth
131+
:members:
121132

122133

123-
Example:
124-
125-
.. code-block:: python
126-
127-
import neo4j
128-
129-
130-
auth = neo4j.Auth("basic", "neo4j", "password")
131134

132135

133136
Auth Token Helper Functions

src/neo4j/_auth_management.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,18 @@ class ExpiringAuth:
5858
:meth:`.AsyncAuthManagers.expiration_based`
5959
6060
.. versionadded:: 5.8
61+
62+
.. versionchanged:: 5.9
63+
Removed parameter and attribute ``expires_in`` (relative expiration
64+
time). Replaced with ``expires_at`` (absolute expiration time).
65+
:meth:`.expires_in` can be used to create an :class:`.ExpiringAuth`
66+
with a relative expiration time.
6167
"""
6268
auth: "_TAuth"
6369
expires_at: t.Optional[float] = None
6470

6571
def expires_in(self, seconds: float) -> "ExpiringAuth":
66-
"""Return a copy of this object with a new expiration time.
72+
"""Return a (flat) copy of this object with a new expiration time.
6773
6874
This is a convenience method for creating an :class:`.ExpiringAuth`
6975
for a relative expiration time ("expires in" instead of "expires at").
@@ -79,6 +85,8 @@ def expires_in(self, seconds: float) -> "ExpiringAuth":
7985
:param seconds:
8086
The number of seconds from now until the authentication information
8187
expires.
88+
89+
.. versionadded:: 5.9
8290
"""
8391
with warnings.catch_warnings():
8492
warnings.filterwarnings("ignore",

0 commit comments

Comments
 (0)