mirror of
https://github.com/encounter/adk-python.git
synced 2026-07-09 18:19:28 -07:00
chore(fix typo): correct typo AUTHLIB_AVIALABLE → AUTHLIB_AVAILABLE
This commit is contained in:
@@ -30,9 +30,9 @@ if TYPE_CHECKING:
|
|||||||
try:
|
try:
|
||||||
from authlib.integrations.requests_client import OAuth2Session
|
from authlib.integrations.requests_client import OAuth2Session
|
||||||
|
|
||||||
AUTHLIB_AVIALABLE = True
|
AUTHLIB_AVAILABLE = True
|
||||||
except ImportError:
|
except ImportError:
|
||||||
AUTHLIB_AVIALABLE = False
|
AUTHLIB_AVAILABLE = False
|
||||||
|
|
||||||
|
|
||||||
class AuthHandler:
|
class AuthHandler:
|
||||||
@@ -146,7 +146,7 @@ class AuthHandler:
|
|||||||
ValueError: If the authorization endpoint is not configured in the auth
|
ValueError: If the authorization endpoint is not configured in the auth
|
||||||
scheme.
|
scheme.
|
||||||
"""
|
"""
|
||||||
if not AUTHLIB_AVIALABLE:
|
if not AUTHLIB_AVAILABLE:
|
||||||
return (
|
return (
|
||||||
self.auth_config.raw_auth_credential.model_copy(deep=True)
|
self.auth_config.raw_auth_credential.model_copy(deep=True)
|
||||||
if self.auth_config.raw_auth_credential
|
if self.auth_config.raw_auth_credential
|
||||||
|
|||||||
@@ -33,9 +33,9 @@ from .base_credential_exchanger import CredentialExchangError
|
|||||||
try:
|
try:
|
||||||
from authlib.integrations.requests_client import OAuth2Session
|
from authlib.integrations.requests_client import OAuth2Session
|
||||||
|
|
||||||
AUTHLIB_AVIALABLE = True
|
AUTHLIB_AVAILABLE = True
|
||||||
except ImportError:
|
except ImportError:
|
||||||
AUTHLIB_AVIALABLE = False
|
AUTHLIB_AVAILABLE = False
|
||||||
|
|
||||||
logger = logging.getLogger("google_adk." + __name__)
|
logger = logging.getLogger("google_adk." + __name__)
|
||||||
|
|
||||||
@@ -68,7 +68,7 @@ class OAuth2CredentialExchanger(BaseCredentialExchanger):
|
|||||||
"auth_scheme is required for OAuth2 credential exchange"
|
"auth_scheme is required for OAuth2 credential exchange"
|
||||||
)
|
)
|
||||||
|
|
||||||
if not AUTHLIB_AVIALABLE:
|
if not AUTHLIB_AVAILABLE:
|
||||||
# If authlib is not available, we cannot exchange the credential.
|
# If authlib is not available, we cannot exchange the credential.
|
||||||
# We return the original credential without exchange.
|
# We return the original credential without exchange.
|
||||||
# The client using this tool can decide to exchange the credential
|
# The client using this tool can decide to exchange the credential
|
||||||
|
|||||||
@@ -29,9 +29,9 @@ try:
|
|||||||
from authlib.integrations.requests_client import OAuth2Session
|
from authlib.integrations.requests_client import OAuth2Session
|
||||||
from authlib.oauth2.rfc6749 import OAuth2Token
|
from authlib.oauth2.rfc6749 import OAuth2Token
|
||||||
|
|
||||||
AUTHLIB_AVIALABLE = True
|
AUTHLIB_AVAILABLE = True
|
||||||
except ImportError:
|
except ImportError:
|
||||||
AUTHLIB_AVIALABLE = False
|
AUTHLIB_AVAILABLE = False
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger("google_adk." + __name__)
|
logger = logging.getLogger("google_adk." + __name__)
|
||||||
|
|||||||
@@ -34,9 +34,9 @@ from .base_credential_refresher import BaseCredentialRefresher
|
|||||||
try:
|
try:
|
||||||
from authlib.oauth2.rfc6749 import OAuth2Token
|
from authlib.oauth2.rfc6749 import OAuth2Token
|
||||||
|
|
||||||
AUTHLIB_AVIALABLE = True
|
AUTHLIB_AVAILABLE = True
|
||||||
except ImportError:
|
except ImportError:
|
||||||
AUTHLIB_AVIALABLE = False
|
AUTHLIB_AVAILABLE = False
|
||||||
|
|
||||||
logger = logging.getLogger("google_adk." + __name__)
|
logger = logging.getLogger("google_adk." + __name__)
|
||||||
|
|
||||||
@@ -63,7 +63,7 @@ class OAuth2CredentialRefresher(BaseCredentialRefresher):
|
|||||||
|
|
||||||
# Handle regular OAuth2 credentials
|
# Handle regular OAuth2 credentials
|
||||||
if auth_credential.oauth2:
|
if auth_credential.oauth2:
|
||||||
if not AUTHLIB_AVIALABLE:
|
if not AUTHLIB_AVAILABLE:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
return OAuth2Token({
|
return OAuth2Token({
|
||||||
@@ -93,7 +93,7 @@ class OAuth2CredentialRefresher(BaseCredentialRefresher):
|
|||||||
|
|
||||||
# Handle regular OAuth2 credentials
|
# Handle regular OAuth2 credentials
|
||||||
if auth_credential.oauth2 and auth_scheme:
|
if auth_credential.oauth2 and auth_scheme:
|
||||||
if not AUTHLIB_AVIALABLE:
|
if not AUTHLIB_AVAILABLE:
|
||||||
return auth_credential
|
return auth_credential
|
||||||
|
|
||||||
if not auth_credential.oauth2:
|
if not auth_credential.oauth2:
|
||||||
|
|||||||
@@ -208,9 +208,9 @@ class TestOAuth2CredentialExchanger:
|
|||||||
|
|
||||||
exchanger = OAuth2CredentialExchanger()
|
exchanger = OAuth2CredentialExchanger()
|
||||||
|
|
||||||
# Mock AUTHLIB_AVIALABLE to False
|
# Mock AUTHLIB_AVAILABLE to False
|
||||||
with patch(
|
with patch(
|
||||||
"google.adk.auth.exchanger.oauth2_credential_exchanger.AUTHLIB_AVIALABLE",
|
"google.adk.auth.exchanger.oauth2_credential_exchanger.AUTHLIB_AVAILABLE",
|
||||||
False,
|
False,
|
||||||
):
|
):
|
||||||
result = await exchanger.exchange(credential, scheme)
|
result = await exchanger.exchange(credential, scheme)
|
||||||
|
|||||||
@@ -456,7 +456,7 @@ class TestExchangeAuthToken:
|
|||||||
self, auth_config_with_auth_code, monkeypatch
|
self, auth_config_with_auth_code, monkeypatch
|
||||||
):
|
):
|
||||||
"""Test when token exchange is not supported."""
|
"""Test when token exchange is not supported."""
|
||||||
monkeypatch.setattr("google.adk.auth.auth_handler.AUTHLIB_AVIALABLE", False)
|
monkeypatch.setattr("google.adk.auth.auth_handler.AUTHLIB_AVAILABLE", False)
|
||||||
|
|
||||||
handler = AuthHandler(auth_config_with_auth_code)
|
handler = AuthHandler(auth_config_with_auth_code)
|
||||||
result = await handler.exchange_auth_token()
|
result = await handler.exchange_auth_token()
|
||||||
|
|||||||
Reference in New Issue
Block a user