Skip to content
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
1 change: 1 addition & 0 deletions doc/changelog.d/640.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Support requests-auth 8.0.0
12 changes: 6 additions & 6 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pyparsing = "^3.0.8"
python-dateutil ="^2.9"

# Packages for oidc extra
requests_auth = { version = ">=6,<9", optional = true }
requests_auth = { version = "^8.0.0", optional = true }
keyring = { version = ">=22,<26", optional = true }

# Packages for linux-kerberos extra
Expand Down
11 changes: 5 additions & 6 deletions src/ansys/openapi/common/_oidc.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,12 @@
import keyring
import requests
from requests.models import CaseInsensitiveDict
from requests_auth import ( # type: ignore[import-untyped]
from requests_auth import ( # type: ignore[import-untyped, unused-ignore]
InvalidGrantRequest,
OAuth2,
OAuth2AuthorizationCodePKCE,
)

# This import is optional and has missing type hints, so use a broad ignore statement
from requests_auth.authentication import OAuth2 # type: ignore

from ._logger import logger
from ._util import (
RequestsConfiguration,
Expand Down Expand Up @@ -149,10 +147,11 @@ def get_session_with_provided_token(self, refresh_token: str) -> requests.Sessio
except InvalidGrantRequest as excinfo:
logger.debug(str(excinfo))
raise ValueError("The provided refresh token was invalid, please request a new token.")
with OAuth2.token_cache.forbid_concurrent_missing_token_function_call:
# noinspection PyProtectedMember
with OAuth2.token_cache._forbid_concurrent_missing_token_function_call: # type: ignore[unused-ignore]
# If we were provided with a new refresh token it's likely that the Identity
# Provider is configured to rotate refresh tokens. Store the new one and
# discard the old one. Otherwise use the existing refresh token.
# discard the old one. Otherwise, use the existing refresh token.
if new_refresh_token is not None:
refresh_token = new_refresh_token
# noinspection PyProtectedMember
Expand Down
2 changes: 1 addition & 1 deletion src/ansys/openapi/common/_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
try:
# noinspection PyUnresolvedReferences
import keyring
import requests_auth # type: ignore[import-untyped] # noqa: F401
import requests_auth # type: ignore[import-untyped, unused-ignore] # noqa: F401

from ._oidc import OIDCSessionFactory
except ImportError:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_oidc.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from covertable import make
import pytest
import requests
from requests_auth.authentication import OAuth2
from requests_auth import OAuth2
import requests_mock

from ansys.openapi.common import ApiClientFactory
Expand Down