Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: mention changes made to ExpiringAuth in 5.9.0 #934

Merged
merged 4 commits into from
May 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions docs/source/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -111,23 +111,26 @@ The auth token is an object of the class :class:`neo4j.Auth` containing static d

.. autoclass:: neo4j.Auth

Example:

.. code-block:: python

import neo4j


auth = neo4j.Auth("basic", "neo4j", "password")


.. autoclass:: neo4j.auth_management.AuthManager
:members:

.. autoclass:: neo4j.auth_management.AuthManagers
:members:

.. autoclass:: neo4j.auth_management.ExpiringAuth
:members:


Example:

.. code-block:: python

import neo4j


auth = neo4j.Auth("basic", "neo4j", "password")


Auth Token Helper Functions
Expand Down
10 changes: 9 additions & 1 deletion src/neo4j/_auth_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,18 @@ class ExpiringAuth:
:meth:`.AsyncAuthManagers.expiration_based`

.. versionadded:: 5.8

.. versionchanged:: 5.9
Removed parameter and attribute ``expires_in`` (relative expiration
time). Replaced with ``expires_at`` (absolute expiration time).
:meth:`.expires_in` can be used to create an :class:`.ExpiringAuth`
with a relative expiration time.
"""
auth: "_TAuth"
expires_at: t.Optional[float] = None

def expires_in(self, seconds: float) -> "ExpiringAuth":
"""Return a copy of this object with a new expiration time.
"""Return a (flat) copy of this object with a new expiration time.

This is a convenience method for creating an :class:`.ExpiringAuth`
for a relative expiration time ("expires in" instead of "expires at").
Expand All @@ -79,6 +85,8 @@ def expires_in(self, seconds: float) -> "ExpiringAuth":
:param seconds:
The number of seconds from now until the authentication information
expires.

.. versionadded:: 5.9
"""
with warnings.catch_warnings():
warnings.filterwarnings("ignore",
Expand Down