T ronmoneta/fix cloudinfo test #466
4 fail, 20 skipped, 261 pass in 12m 26s
Annotations
Check warning on line 0 in azure-kusto-data.tests.test_e2e_data.TestE2E
github-actions / Test Results
All 5 runs failed: test_no_redirects_fail_in_client[301] (azure-kusto-data.tests.test_e2e_data.TestE2E)
artifacts/Unit Test Results (Python 3.10)/pytest.xml [took 0s]
artifacts/Unit Test Results (Python 3.11)/pytest.xml [took 0s]
artifacts/Unit Test Results (Python 3.7)/pytest.xml [took 0s]
artifacts/Unit Test Results (Python 3.8)/pytest.xml [took 0s]
artifacts/Unit Test Results (Python 3.9)/pytest.xml [took 0s]
Raw output
azure.kusto.data.exceptions.KustoAuthenticationError: KustoAuthenticationError('AzureIdentityTokenProvider', 'ClientAuthenticationError("Authentication failed: 'NoneType' object has no attribute 'request'")', '{'credential': <azure.identity._credentials.default.DefaultAzureCredential object at 0x7fd32b858310>, 'resource': 'https://statusreturner.azurewebsites.net'}')
args = (<azure.identity._credentials.client_secret.ClientSecretCredential object at 0x7fd32b859250>, 'https://kusto.dev.kusto.windows.net/.default')
kwargs = {'claims': None, 'tenant_id': None}
auth_error = ClientAuthenticationError("Authentication failed: 'NoneType' object has no attribute 'request'")
@functools.wraps(fn)
def wrapper(*args, **kwargs):
try:
> return fn(*args, **kwargs)
../../../.local/lib/python3.11/site-packages/azure/identity/_internal/decorators.py:79:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../.local/lib/python3.11/site-packages/azure/identity/_internal/client_credential_base.py:40: in _request_token
result = app.acquire_token_for_client(list(scopes), claims_challenge=kwargs.pop("claims", None))
../../../.local/lib/python3.11/site-packages/msal/application.py:2119: in acquire_token_for_client
return _clean_up(self._acquire_token_silent_with_error(
../../../.local/lib/python3.11/site-packages/msal/application.py:1302: in _acquire_token_silent_with_error
result = self._acquire_token_silent_from_cache_and_possibly_refresh_it(
../../../.local/lib/python3.11/site-packages/msal/application.py:1430: in _acquire_token_silent_from_cache_and_possibly_refresh_it
result = self._acquire_token_for_client(
../../../.local/lib/python3.11/site-packages/msal/application.py:2138: in _acquire_token_for_client
response = client.obtain_token_for_client(
../../../.local/lib/python3.11/site-packages/msal/oauth2cli/oauth2.py:752: in obtain_token_for_client
return self._obtain_token("client_credentials", data=data, **kwargs)
../../../.local/lib/python3.11/site-packages/msal/oauth2cli/oidc.py:116: in _obtain_token
ret = super(Client, self)._obtain_token(grant_type, *args, **kwargs)
../../../.local/lib/python3.11/site-packages/msal/oauth2cli/oauth2.py:771: in _obtain_token
resp = super(Client, self)._obtain_token(
../../../.local/lib/python3.11/site-packages/msal/oauth2cli/oauth2.py:234: in _obtain_token
resp = (post or self._http_client.post)(
../../../.local/lib/python3.11/site-packages/msal/individual_cache.py:269: in wrapper
value = function(*args, **kwargs)
../../../.local/lib/python3.11/site-packages/msal/individual_cache.py:269: in wrapper
value = function(*args, **kwargs)
../../../.local/lib/python3.11/site-packages/azure/identity/_internal/msal_client.py:99: in post
response = self._pipeline.run(request, stream=False, retry_on_methods=_POST)
../../../.local/lib/python3.11/site-packages/azure/core/pipeline/_base.py:230: in run
return first_node.send(pipeline_request)
../../../.local/lib/python3.11/site-packages/azure/core/pipeline/_base.py:86: in send
response = self.next.send(request)
../../../.local/lib/python3.11/site-packages/azure/core/pipeline/_base.py:86: in send
response = self.next.send(request)
../../../.local/lib/python3.11/site-packages/azure/core/pipeline/_base.py:86: in send
response = self.next.send(request)
../../../.local/lib/python3.11/site-packages/azure/core/pipeline/_base.py:86: in send
response = self.next.send(request)
../../../.local/lib/python3.11/site-packages/azure/core/pipeline/policies/_retry.py:531: in send
response = self.next.send(request)
../../../.local/lib/python3.11/site-packages/azure/core/pipeline/_base.py:86: in send
response = self.next.send(request)
../../../.local/lib/python3.11/site-packages/azure/core/pipeline/_base.py:86: in send
response = self.next.send(request)
../../../.local/lib/python3.11/site-packages/azure/core/pipeline/_base.py:86: in send
response = self.next.send(request)
../../../.local/lib/python3.11/site-packages/azure/core/pipeline/_base.py:86: in send
response = self.next.send(request)
../../../.local/lib/python3.11/site-packages/azure/core/pipeline/_base.py:119: in send
self._sender.send(request.http_request, **request.context.options),
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <azure.core.pipeline.transport._requests_basic.RequestsTransport object at 0x7fd32b859b90>
request = <HttpRequest [POST], url: 'https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/oauth2/v2.0/token'>
kwargs = {'stream': False}, response = None, error = None
connection_timeout = 300, timeout = (300, 300), read_timeout = 300
def send(self, request: Union[HttpRequest, "RestHttpRequest"], **kwargs) -> Union[HttpResponse, "RestHttpResponse"]:
"""Send request object according to configuration.
:param request: The request object to be sent.
:type request: ~azure.core.pipeline.transport.HttpRequest
:return: An HTTPResponse object.
:rtype: ~azure.core.pipeline.transport.HttpResponse
:keyword requests.Session session: will override the driver session and use yours.
Should NOT be done unless really required. Anything else is sent straight to requests.
:keyword dict proxies: will define the proxy to use. Proxy is a dict (protocol, url)
"""
self.open()
response = None
error: Optional[AzureErrorUnion] = None
try:
connection_timeout = kwargs.pop("connection_timeout", self.connection_config.timeout)
if isinstance(connection_timeout, tuple):
if "read_timeout" in kwargs:
raise ValueError("Cannot set tuple connection_timeout and read_timeout together")
_LOGGER.warning("Tuple timeout setting is deprecated")
timeout = connection_timeout
else:
read_timeout = kwargs.pop("read_timeout", self.connection_config.read_timeout)
timeout = (connection_timeout, read_timeout)
> response = self.session.request( # type: ignore
request.method,
request.url,
headers=request.headers,
data=request.data,
files=request.files,
verify=kwargs.pop("connection_verify", self.connection_config.verify),
timeout=timeout,
cert=kwargs.pop("connection_cert", self.connection_config.cert),
allow_redirects=False,
**kwargs
)
E AttributeError: 'NoneType' object has no attribute 'request'
../../../.local/lib/python3.11/site-packages/azure/core/pipeline/transport/_requests_basic.py:343: AttributeError
The above exception was the direct cause of the following exception:
self = <azure.kusto.data.security._AadHelper object at 0x7fd32b0d6310>
async def acquire_authorization_header_async(self):
try:
> return _get_header_from_dict(await self.token_provider.get_token_async())
../../../.local/lib/python3.11/site-packages/azure/kusto/data/security.py:88:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../.local/lib/python3.11/site-packages/azure/kusto/data/_token_providers.py:196: in get_token_async
return await _get_token_async()
../../../.local/lib/python3.11/site-packages/azure/core/tracing/decorator_async.py:77: in wrapper_use_tracer
return await func(*args, **kwargs)
../../../.local/lib/python3.11/site-packages/azure/kusto/data/_token_providers.py:190: in _get_token_async
token = await MonitoredActivity.invoke_async(
../../../.local/lib/python3.11/site-packages/azure/kusto/data/_telemetry.py:127: in invoke_async
return await span()
../../../.local/lib/python3.11/site-packages/azure/core/tracing/decorator_async.py:77: in wrapper_use_tracer
return await func(*args, **kwargs)
../../../.local/lib/python3.11/site-packages/azure/kusto/data/_token_providers.py:657: in _get_token_impl_async
t = await sync_to_async(self.credential.get_token)(self._scopes[0])
../../../.local/lib/python3.11/site-packages/asgiref/sync.py:479: in __call__
ret: _R = await loop.run_in_executor(
/opt/hostedtoolcache/Python/3.11.6/x64/lib/python3.11/concurrent/futures/thread.py:58: in run
result = self.fn(*self.args, **self.kwargs)
../../../.local/lib/python3.11/site-packages/asgiref/sync.py:538: in thread_handler
return func(*args, **kwargs)
../../../.local/lib/python3.11/site-packages/azure/identity/_credentials/default.py:219: in get_token
token = self._successful_credential.get_token(*scopes, claims=claims, tenant_id=tenant_id, **kwargs)
../../../.local/lib/python3.11/site-packages/azure/identity/_internal/decorators.py:33: in wrapper
token = fn(*args, **kwargs)
../../../.local/lib/python3.11/site-packages/azure/identity/_credentials/environment.py:151: in get_token
return self._credential.get_token(*scopes, claims=claims, tenant_id=tenant_id, **kwargs)
../../../.local/lib/python3.11/site-packages/azure/identity/_internal/get_token_mixin.py:86: in get_token
token = self._request_token(*scopes, claims=claims, tenant_id=tenant_id, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
args = (<azure.identity._credentials.client_secret.ClientSecretCredential object at 0x7fd32b859250>, 'https://kusto.dev.kusto.windows.net/.default')
kwargs = {'claims': None, 'tenant_id': None}
auth_error = ClientAuthenticationError("Authentication failed: 'NoneType' object has no attribute 'request'")
@functools.wraps(fn)
def wrapper(*args, **kwargs):
try:
return fn(*args, **kwargs)
except ClientAuthenticationError:
raise
except Exception as ex: # pylint:disable=broad-except
auth_error = ClientAuthenticationError(message="Authentication failed: {}".format(ex))
> raise auth_error from ex
E azure.core.exceptions.ClientAuthenticationError: Authentication failed: 'NoneType' object has no attribute 'request'
../../../.local/lib/python3.11/site-packages/azure/identity/_internal/decorators.py:84: ClientAuthenticationError
During handling of the above exception, another exception occurred:
self = <tests.test_e2e_data.TestE2E object at 0x7fd33ae5c510>, code = 301
@pytest.mark.asyncio
@pytest.mark.parametrize("code", [301, 302, 307, 308])
async def test_no_redirects_fail_in_client(self, code):
well_known_kusto_endpoints.add_trusted_hosts([MatchRule("statusreturner.azurewebsites.net", False)], False)
async with AsyncKustoClient(
KustoConnectionStringBuilder.with_azure_token_credential(f"https://statusreturner.azurewebsites.net/{code}/segment", self.async_cred)
) as client:
with pytest.raises(KustoServiceError) as ex:
> await client.execute("db", "table")
azure-kusto-data/tests/test_e2e_data.py:384:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../.local/lib/python3.11/site-packages/azure/kusto/data/aio/client.py:50: in execute
return await self.execute_query(database, query, properties)
../../../.local/lib/python3.11/site-packages/azure/core/tracing/decorator_async.py:77: in wrapper_use_tracer
return await func(*args, **kwargs)
../../../.local/lib/python3.11/site-packages/azure/kusto/data/aio/client.py:58: in execute_query
return await self._execute(self._query_endpoint, database, query, None, KustoClient._query_default_timeout, properties)
../../../.local/lib/python3.11/site-packages/azure/kusto/data/aio/client.py:145: in _execute
request_headers["Authorization"] = await self._aad_helper.acquire_authorization_header_async()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <azure.kusto.data.security._AadHelper object at 0x7fd32b0d6310>
async def acquire_authorization_header_async(self):
try:
return _get_header_from_dict(await self.token_provider.get_token_async())
except Exception as error:
kwargs = await self.token_provider.context_async()
kwargs["resource"] = self.kusto_uri
> raise KustoAuthenticationError(self.token_provider.name(), error, **kwargs)
E azure.kusto.data.exceptions.KustoAuthenticationError: KustoAuthenticationError('AzureIdentityTokenProvider', 'ClientAuthenticationError("Authentication failed: 'NoneType' object has no attribute 'request'")', '{'credential': <azure.identity._credentials.default.DefaultAzureCredential object at 0x7fd32b858310>, 'resource': 'https://statusreturner.azurewebsites.net'}')
../../../.local/lib/python3.11/site-packages/azure/kusto/data/security.py:92: KustoAuthenticationError
Check warning on line 0 in azure-kusto-data.tests.test_e2e_data.TestE2E
github-actions / Test Results
All 5 runs failed: test_no_redirects_fail_in_client[302] (azure-kusto-data.tests.test_e2e_data.TestE2E)
artifacts/Unit Test Results (Python 3.10)/pytest.xml [took 0s]
artifacts/Unit Test Results (Python 3.11)/pytest.xml [took 0s]
artifacts/Unit Test Results (Python 3.7)/pytest.xml [took 0s]
artifacts/Unit Test Results (Python 3.8)/pytest.xml [took 0s]
artifacts/Unit Test Results (Python 3.9)/pytest.xml [took 0s]
Raw output
azure.kusto.data.exceptions.KustoAuthenticationError: KustoAuthenticationError('AzureIdentityTokenProvider', 'ClientAuthenticationError("Authentication failed: 'NoneType' object has no attribute 'request'")', '{'credential': <azure.identity._credentials.default.DefaultAzureCredential object at 0x7fd32b858310>, 'resource': 'https://statusreturner.azurewebsites.net'}')
args = (<azure.identity._credentials.client_secret.ClientSecretCredential object at 0x7fd32b859250>, 'https://kusto.dev.kusto.windows.net/.default')
kwargs = {'claims': None, 'tenant_id': None}
auth_error = ClientAuthenticationError("Authentication failed: 'NoneType' object has no attribute 'request'")
@functools.wraps(fn)
def wrapper(*args, **kwargs):
try:
> return fn(*args, **kwargs)
../../../.local/lib/python3.11/site-packages/azure/identity/_internal/decorators.py:79:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../.local/lib/python3.11/site-packages/azure/identity/_internal/client_credential_base.py:40: in _request_token
result = app.acquire_token_for_client(list(scopes), claims_challenge=kwargs.pop("claims", None))
../../../.local/lib/python3.11/site-packages/msal/application.py:2119: in acquire_token_for_client
return _clean_up(self._acquire_token_silent_with_error(
../../../.local/lib/python3.11/site-packages/msal/application.py:1302: in _acquire_token_silent_with_error
result = self._acquire_token_silent_from_cache_and_possibly_refresh_it(
../../../.local/lib/python3.11/site-packages/msal/application.py:1430: in _acquire_token_silent_from_cache_and_possibly_refresh_it
result = self._acquire_token_for_client(
../../../.local/lib/python3.11/site-packages/msal/application.py:2138: in _acquire_token_for_client
response = client.obtain_token_for_client(
../../../.local/lib/python3.11/site-packages/msal/oauth2cli/oauth2.py:752: in obtain_token_for_client
return self._obtain_token("client_credentials", data=data, **kwargs)
../../../.local/lib/python3.11/site-packages/msal/oauth2cli/oidc.py:116: in _obtain_token
ret = super(Client, self)._obtain_token(grant_type, *args, **kwargs)
../../../.local/lib/python3.11/site-packages/msal/oauth2cli/oauth2.py:771: in _obtain_token
resp = super(Client, self)._obtain_token(
../../../.local/lib/python3.11/site-packages/msal/oauth2cli/oauth2.py:234: in _obtain_token
resp = (post or self._http_client.post)(
../../../.local/lib/python3.11/site-packages/msal/individual_cache.py:269: in wrapper
value = function(*args, **kwargs)
../../../.local/lib/python3.11/site-packages/msal/individual_cache.py:269: in wrapper
value = function(*args, **kwargs)
../../../.local/lib/python3.11/site-packages/azure/identity/_internal/msal_client.py:99: in post
response = self._pipeline.run(request, stream=False, retry_on_methods=_POST)
../../../.local/lib/python3.11/site-packages/azure/core/pipeline/_base.py:230: in run
return first_node.send(pipeline_request)
../../../.local/lib/python3.11/site-packages/azure/core/pipeline/_base.py:86: in send
response = self.next.send(request)
../../../.local/lib/python3.11/site-packages/azure/core/pipeline/_base.py:86: in send
response = self.next.send(request)
../../../.local/lib/python3.11/site-packages/azure/core/pipeline/_base.py:86: in send
response = self.next.send(request)
../../../.local/lib/python3.11/site-packages/azure/core/pipeline/_base.py:86: in send
response = self.next.send(request)
../../../.local/lib/python3.11/site-packages/azure/core/pipeline/policies/_retry.py:531: in send
response = self.next.send(request)
../../../.local/lib/python3.11/site-packages/azure/core/pipeline/_base.py:86: in send
response = self.next.send(request)
../../../.local/lib/python3.11/site-packages/azure/core/pipeline/_base.py:86: in send
response = self.next.send(request)
../../../.local/lib/python3.11/site-packages/azure/core/pipeline/_base.py:86: in send
response = self.next.send(request)
../../../.local/lib/python3.11/site-packages/azure/core/pipeline/_base.py:86: in send
response = self.next.send(request)
../../../.local/lib/python3.11/site-packages/azure/core/pipeline/_base.py:119: in send
self._sender.send(request.http_request, **request.context.options),
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <azure.core.pipeline.transport._requests_basic.RequestsTransport object at 0x7fd32b859b90>
request = <HttpRequest [POST], url: 'https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/oauth2/v2.0/token'>
kwargs = {'stream': False}, response = None, error = None
connection_timeout = 300, timeout = (300, 300), read_timeout = 300
def send(self, request: Union[HttpRequest, "RestHttpRequest"], **kwargs) -> Union[HttpResponse, "RestHttpResponse"]:
"""Send request object according to configuration.
:param request: The request object to be sent.
:type request: ~azure.core.pipeline.transport.HttpRequest
:return: An HTTPResponse object.
:rtype: ~azure.core.pipeline.transport.HttpResponse
:keyword requests.Session session: will override the driver session and use yours.
Should NOT be done unless really required. Anything else is sent straight to requests.
:keyword dict proxies: will define the proxy to use. Proxy is a dict (protocol, url)
"""
self.open()
response = None
error: Optional[AzureErrorUnion] = None
try:
connection_timeout = kwargs.pop("connection_timeout", self.connection_config.timeout)
if isinstance(connection_timeout, tuple):
if "read_timeout" in kwargs:
raise ValueError("Cannot set tuple connection_timeout and read_timeout together")
_LOGGER.warning("Tuple timeout setting is deprecated")
timeout = connection_timeout
else:
read_timeout = kwargs.pop("read_timeout", self.connection_config.read_timeout)
timeout = (connection_timeout, read_timeout)
> response = self.session.request( # type: ignore
request.method,
request.url,
headers=request.headers,
data=request.data,
files=request.files,
verify=kwargs.pop("connection_verify", self.connection_config.verify),
timeout=timeout,
cert=kwargs.pop("connection_cert", self.connection_config.cert),
allow_redirects=False,
**kwargs
)
E AttributeError: 'NoneType' object has no attribute 'request'
../../../.local/lib/python3.11/site-packages/azure/core/pipeline/transport/_requests_basic.py:343: AttributeError
The above exception was the direct cause of the following exception:
self = <azure.kusto.data.security._AadHelper object at 0x7fd3268fc810>
async def acquire_authorization_header_async(self):
try:
> return _get_header_from_dict(await self.token_provider.get_token_async())
../../../.local/lib/python3.11/site-packages/azure/kusto/data/security.py:88:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../.local/lib/python3.11/site-packages/azure/kusto/data/_token_providers.py:196: in get_token_async
return await _get_token_async()
../../../.local/lib/python3.11/site-packages/azure/core/tracing/decorator_async.py:77: in wrapper_use_tracer
return await func(*args, **kwargs)
../../../.local/lib/python3.11/site-packages/azure/kusto/data/_token_providers.py:190: in _get_token_async
token = await MonitoredActivity.invoke_async(
../../../.local/lib/python3.11/site-packages/azure/kusto/data/_telemetry.py:127: in invoke_async
return await span()
../../../.local/lib/python3.11/site-packages/azure/core/tracing/decorator_async.py:77: in wrapper_use_tracer
return await func(*args, **kwargs)
../../../.local/lib/python3.11/site-packages/azure/kusto/data/_token_providers.py:657: in _get_token_impl_async
t = await sync_to_async(self.credential.get_token)(self._scopes[0])
../../../.local/lib/python3.11/site-packages/asgiref/sync.py:479: in __call__
ret: _R = await loop.run_in_executor(
/opt/hostedtoolcache/Python/3.11.6/x64/lib/python3.11/concurrent/futures/thread.py:58: in run
result = self.fn(*self.args, **self.kwargs)
../../../.local/lib/python3.11/site-packages/asgiref/sync.py:538: in thread_handler
return func(*args, **kwargs)
../../../.local/lib/python3.11/site-packages/azure/identity/_credentials/default.py:219: in get_token
token = self._successful_credential.get_token(*scopes, claims=claims, tenant_id=tenant_id, **kwargs)
../../../.local/lib/python3.11/site-packages/azure/identity/_internal/decorators.py:33: in wrapper
token = fn(*args, **kwargs)
../../../.local/lib/python3.11/site-packages/azure/identity/_credentials/environment.py:151: in get_token
return self._credential.get_token(*scopes, claims=claims, tenant_id=tenant_id, **kwargs)
../../../.local/lib/python3.11/site-packages/azure/identity/_internal/get_token_mixin.py:86: in get_token
token = self._request_token(*scopes, claims=claims, tenant_id=tenant_id, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
args = (<azure.identity._credentials.client_secret.ClientSecretCredential object at 0x7fd32b859250>, 'https://kusto.dev.kusto.windows.net/.default')
kwargs = {'claims': None, 'tenant_id': None}
auth_error = ClientAuthenticationError("Authentication failed: 'NoneType' object has no attribute 'request'")
@functools.wraps(fn)
def wrapper(*args, **kwargs):
try:
return fn(*args, **kwargs)
except ClientAuthenticationError:
raise
except Exception as ex: # pylint:disable=broad-except
auth_error = ClientAuthenticationError(message="Authentication failed: {}".format(ex))
> raise auth_error from ex
E azure.core.exceptions.ClientAuthenticationError: Authentication failed: 'NoneType' object has no attribute 'request'
../../../.local/lib/python3.11/site-packages/azure/identity/_internal/decorators.py:84: ClientAuthenticationError
During handling of the above exception, another exception occurred:
self = <tests.test_e2e_data.TestE2E object at 0x7fd33ae5d910>, code = 302
@pytest.mark.asyncio
@pytest.mark.parametrize("code", [301, 302, 307, 308])
async def test_no_redirects_fail_in_client(self, code):
well_known_kusto_endpoints.add_trusted_hosts([MatchRule("statusreturner.azurewebsites.net", False)], False)
async with AsyncKustoClient(
KustoConnectionStringBuilder.with_azure_token_credential(f"https://statusreturner.azurewebsites.net/{code}/segment", self.async_cred)
) as client:
with pytest.raises(KustoServiceError) as ex:
> await client.execute("db", "table")
azure-kusto-data/tests/test_e2e_data.py:384:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../.local/lib/python3.11/site-packages/azure/kusto/data/aio/client.py:50: in execute
return await self.execute_query(database, query, properties)
../../../.local/lib/python3.11/site-packages/azure/core/tracing/decorator_async.py:77: in wrapper_use_tracer
return await func(*args, **kwargs)
../../../.local/lib/python3.11/site-packages/azure/kusto/data/aio/client.py:58: in execute_query
return await self._execute(self._query_endpoint, database, query, None, KustoClient._query_default_timeout, properties)
../../../.local/lib/python3.11/site-packages/azure/kusto/data/aio/client.py:145: in _execute
request_headers["Authorization"] = await self._aad_helper.acquire_authorization_header_async()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <azure.kusto.data.security._AadHelper object at 0x7fd3268fc810>
async def acquire_authorization_header_async(self):
try:
return _get_header_from_dict(await self.token_provider.get_token_async())
except Exception as error:
kwargs = await self.token_provider.context_async()
kwargs["resource"] = self.kusto_uri
> raise KustoAuthenticationError(self.token_provider.name(), error, **kwargs)
E azure.kusto.data.exceptions.KustoAuthenticationError: KustoAuthenticationError('AzureIdentityTokenProvider', 'ClientAuthenticationError("Authentication failed: 'NoneType' object has no attribute 'request'")', '{'credential': <azure.identity._credentials.default.DefaultAzureCredential object at 0x7fd32b858310>, 'resource': 'https://statusreturner.azurewebsites.net'}')
../../../.local/lib/python3.11/site-packages/azure/kusto/data/security.py:92: KustoAuthenticationError
Check warning on line 0 in azure-kusto-data.tests.test_e2e_data.TestE2E
github-actions / Test Results
All 5 runs failed: test_no_redirects_fail_in_client[307] (azure-kusto-data.tests.test_e2e_data.TestE2E)
artifacts/Unit Test Results (Python 3.10)/pytest.xml [took 0s]
artifacts/Unit Test Results (Python 3.11)/pytest.xml [took 0s]
artifacts/Unit Test Results (Python 3.7)/pytest.xml [took 0s]
artifacts/Unit Test Results (Python 3.8)/pytest.xml [took 0s]
artifacts/Unit Test Results (Python 3.9)/pytest.xml [took 0s]
Raw output
azure.kusto.data.exceptions.KustoAuthenticationError: KustoAuthenticationError('AzureIdentityTokenProvider', 'ClientAuthenticationError("Authentication failed: 'NoneType' object has no attribute 'request'")', '{'credential': <azure.identity._credentials.default.DefaultAzureCredential object at 0x7fd32b858310>, 'resource': 'https://statusreturner.azurewebsites.net'}')
args = (<azure.identity._credentials.client_secret.ClientSecretCredential object at 0x7fd32b859250>, 'https://kusto.dev.kusto.windows.net/.default')
kwargs = {'claims': None, 'tenant_id': None}
auth_error = ClientAuthenticationError("Authentication failed: 'NoneType' object has no attribute 'request'")
@functools.wraps(fn)
def wrapper(*args, **kwargs):
try:
> return fn(*args, **kwargs)
../../../.local/lib/python3.11/site-packages/azure/identity/_internal/decorators.py:79:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../.local/lib/python3.11/site-packages/azure/identity/_internal/client_credential_base.py:40: in _request_token
result = app.acquire_token_for_client(list(scopes), claims_challenge=kwargs.pop("claims", None))
../../../.local/lib/python3.11/site-packages/msal/application.py:2119: in acquire_token_for_client
return _clean_up(self._acquire_token_silent_with_error(
../../../.local/lib/python3.11/site-packages/msal/application.py:1302: in _acquire_token_silent_with_error
result = self._acquire_token_silent_from_cache_and_possibly_refresh_it(
../../../.local/lib/python3.11/site-packages/msal/application.py:1430: in _acquire_token_silent_from_cache_and_possibly_refresh_it
result = self._acquire_token_for_client(
../../../.local/lib/python3.11/site-packages/msal/application.py:2138: in _acquire_token_for_client
response = client.obtain_token_for_client(
../../../.local/lib/python3.11/site-packages/msal/oauth2cli/oauth2.py:752: in obtain_token_for_client
return self._obtain_token("client_credentials", data=data, **kwargs)
../../../.local/lib/python3.11/site-packages/msal/oauth2cli/oidc.py:116: in _obtain_token
ret = super(Client, self)._obtain_token(grant_type, *args, **kwargs)
../../../.local/lib/python3.11/site-packages/msal/oauth2cli/oauth2.py:771: in _obtain_token
resp = super(Client, self)._obtain_token(
../../../.local/lib/python3.11/site-packages/msal/oauth2cli/oauth2.py:234: in _obtain_token
resp = (post or self._http_client.post)(
../../../.local/lib/python3.11/site-packages/msal/individual_cache.py:269: in wrapper
value = function(*args, **kwargs)
../../../.local/lib/python3.11/site-packages/msal/individual_cache.py:269: in wrapper
value = function(*args, **kwargs)
../../../.local/lib/python3.11/site-packages/azure/identity/_internal/msal_client.py:99: in post
response = self._pipeline.run(request, stream=False, retry_on_methods=_POST)
../../../.local/lib/python3.11/site-packages/azure/core/pipeline/_base.py:230: in run
return first_node.send(pipeline_request)
../../../.local/lib/python3.11/site-packages/azure/core/pipeline/_base.py:86: in send
response = self.next.send(request)
../../../.local/lib/python3.11/site-packages/azure/core/pipeline/_base.py:86: in send
response = self.next.send(request)
../../../.local/lib/python3.11/site-packages/azure/core/pipeline/_base.py:86: in send
response = self.next.send(request)
../../../.local/lib/python3.11/site-packages/azure/core/pipeline/_base.py:86: in send
response = self.next.send(request)
../../../.local/lib/python3.11/site-packages/azure/core/pipeline/policies/_retry.py:531: in send
response = self.next.send(request)
../../../.local/lib/python3.11/site-packages/azure/core/pipeline/_base.py:86: in send
response = self.next.send(request)
../../../.local/lib/python3.11/site-packages/azure/core/pipeline/_base.py:86: in send
response = self.next.send(request)
../../../.local/lib/python3.11/site-packages/azure/core/pipeline/_base.py:86: in send
response = self.next.send(request)
../../../.local/lib/python3.11/site-packages/azure/core/pipeline/_base.py:86: in send
response = self.next.send(request)
../../../.local/lib/python3.11/site-packages/azure/core/pipeline/_base.py:119: in send
self._sender.send(request.http_request, **request.context.options),
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <azure.core.pipeline.transport._requests_basic.RequestsTransport object at 0x7fd32b859b90>
request = <HttpRequest [POST], url: 'https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/oauth2/v2.0/token'>
kwargs = {'stream': False}, response = None, error = None
connection_timeout = 300, timeout = (300, 300), read_timeout = 300
def send(self, request: Union[HttpRequest, "RestHttpRequest"], **kwargs) -> Union[HttpResponse, "RestHttpResponse"]:
"""Send request object according to configuration.
:param request: The request object to be sent.
:type request: ~azure.core.pipeline.transport.HttpRequest
:return: An HTTPResponse object.
:rtype: ~azure.core.pipeline.transport.HttpResponse
:keyword requests.Session session: will override the driver session and use yours.
Should NOT be done unless really required. Anything else is sent straight to requests.
:keyword dict proxies: will define the proxy to use. Proxy is a dict (protocol, url)
"""
self.open()
response = None
error: Optional[AzureErrorUnion] = None
try:
connection_timeout = kwargs.pop("connection_timeout", self.connection_config.timeout)
if isinstance(connection_timeout, tuple):
if "read_timeout" in kwargs:
raise ValueError("Cannot set tuple connection_timeout and read_timeout together")
_LOGGER.warning("Tuple timeout setting is deprecated")
timeout = connection_timeout
else:
read_timeout = kwargs.pop("read_timeout", self.connection_config.read_timeout)
timeout = (connection_timeout, read_timeout)
> response = self.session.request( # type: ignore
request.method,
request.url,
headers=request.headers,
data=request.data,
files=request.files,
verify=kwargs.pop("connection_verify", self.connection_config.verify),
timeout=timeout,
cert=kwargs.pop("connection_cert", self.connection_config.cert),
allow_redirects=False,
**kwargs
)
E AttributeError: 'NoneType' object has no attribute 'request'
../../../.local/lib/python3.11/site-packages/azure/core/pipeline/transport/_requests_basic.py:343: AttributeError
The above exception was the direct cause of the following exception:
self = <azure.kusto.data.security._AadHelper object at 0x7fd32b375b50>
async def acquire_authorization_header_async(self):
try:
> return _get_header_from_dict(await self.token_provider.get_token_async())
../../../.local/lib/python3.11/site-packages/azure/kusto/data/security.py:88:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../.local/lib/python3.11/site-packages/azure/kusto/data/_token_providers.py:196: in get_token_async
return await _get_token_async()
../../../.local/lib/python3.11/site-packages/azure/core/tracing/decorator_async.py:77: in wrapper_use_tracer
return await func(*args, **kwargs)
../../../.local/lib/python3.11/site-packages/azure/kusto/data/_token_providers.py:190: in _get_token_async
token = await MonitoredActivity.invoke_async(
../../../.local/lib/python3.11/site-packages/azure/kusto/data/_telemetry.py:127: in invoke_async
return await span()
../../../.local/lib/python3.11/site-packages/azure/core/tracing/decorator_async.py:77: in wrapper_use_tracer
return await func(*args, **kwargs)
../../../.local/lib/python3.11/site-packages/azure/kusto/data/_token_providers.py:657: in _get_token_impl_async
t = await sync_to_async(self.credential.get_token)(self._scopes[0])
../../../.local/lib/python3.11/site-packages/asgiref/sync.py:479: in __call__
ret: _R = await loop.run_in_executor(
/opt/hostedtoolcache/Python/3.11.6/x64/lib/python3.11/concurrent/futures/thread.py:58: in run
result = self.fn(*self.args, **self.kwargs)
../../../.local/lib/python3.11/site-packages/asgiref/sync.py:538: in thread_handler
return func(*args, **kwargs)
../../../.local/lib/python3.11/site-packages/azure/identity/_credentials/default.py:219: in get_token
token = self._successful_credential.get_token(*scopes, claims=claims, tenant_id=tenant_id, **kwargs)
../../../.local/lib/python3.11/site-packages/azure/identity/_internal/decorators.py:33: in wrapper
token = fn(*args, **kwargs)
../../../.local/lib/python3.11/site-packages/azure/identity/_credentials/environment.py:151: in get_token
return self._credential.get_token(*scopes, claims=claims, tenant_id=tenant_id, **kwargs)
../../../.local/lib/python3.11/site-packages/azure/identity/_internal/get_token_mixin.py:86: in get_token
token = self._request_token(*scopes, claims=claims, tenant_id=tenant_id, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
args = (<azure.identity._credentials.client_secret.ClientSecretCredential object at 0x7fd32b859250>, 'https://kusto.dev.kusto.windows.net/.default')
kwargs = {'claims': None, 'tenant_id': None}
auth_error = ClientAuthenticationError("Authentication failed: 'NoneType' object has no attribute 'request'")
@functools.wraps(fn)
def wrapper(*args, **kwargs):
try:
return fn(*args, **kwargs)
except ClientAuthenticationError:
raise
except Exception as ex: # pylint:disable=broad-except
auth_error = ClientAuthenticationError(message="Authentication failed: {}".format(ex))
> raise auth_error from ex
E azure.core.exceptions.ClientAuthenticationError: Authentication failed: 'NoneType' object has no attribute 'request'
../../../.local/lib/python3.11/site-packages/azure/identity/_internal/decorators.py:84: ClientAuthenticationError
During handling of the above exception, another exception occurred:
self = <tests.test_e2e_data.TestE2E object at 0x7fd33ae5c110>, code = 307
@pytest.mark.asyncio
@pytest.mark.parametrize("code", [301, 302, 307, 308])
async def test_no_redirects_fail_in_client(self, code):
well_known_kusto_endpoints.add_trusted_hosts([MatchRule("statusreturner.azurewebsites.net", False)], False)
async with AsyncKustoClient(
KustoConnectionStringBuilder.with_azure_token_credential(f"https://statusreturner.azurewebsites.net/{code}/segment", self.async_cred)
) as client:
with pytest.raises(KustoServiceError) as ex:
> await client.execute("db", "table")
azure-kusto-data/tests/test_e2e_data.py:384:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../.local/lib/python3.11/site-packages/azure/kusto/data/aio/client.py:50: in execute
return await self.execute_query(database, query, properties)
../../../.local/lib/python3.11/site-packages/azure/core/tracing/decorator_async.py:77: in wrapper_use_tracer
return await func(*args, **kwargs)
../../../.local/lib/python3.11/site-packages/azure/kusto/data/aio/client.py:58: in execute_query
return await self._execute(self._query_endpoint, database, query, None, KustoClient._query_default_timeout, properties)
../../../.local/lib/python3.11/site-packages/azure/kusto/data/aio/client.py:145: in _execute
request_headers["Authorization"] = await self._aad_helper.acquire_authorization_header_async()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <azure.kusto.data.security._AadHelper object at 0x7fd32b375b50>
async def acquire_authorization_header_async(self):
try:
return _get_header_from_dict(await self.token_provider.get_token_async())
except Exception as error:
kwargs = await self.token_provider.context_async()
kwargs["resource"] = self.kusto_uri
> raise KustoAuthenticationError(self.token_provider.name(), error, **kwargs)
E azure.kusto.data.exceptions.KustoAuthenticationError: KustoAuthenticationError('AzureIdentityTokenProvider', 'ClientAuthenticationError("Authentication failed: 'NoneType' object has no attribute 'request'")', '{'credential': <azure.identity._credentials.default.DefaultAzureCredential object at 0x7fd32b858310>, 'resource': 'https://statusreturner.azurewebsites.net'}')
../../../.local/lib/python3.11/site-packages/azure/kusto/data/security.py:92: KustoAuthenticationError
Check warning on line 0 in azure-kusto-data.tests.test_e2e_data.TestE2E
github-actions / Test Results
All 5 runs failed: test_no_redirects_fail_in_client[308] (azure-kusto-data.tests.test_e2e_data.TestE2E)
artifacts/Unit Test Results (Python 3.10)/pytest.xml [took 0s]
artifacts/Unit Test Results (Python 3.11)/pytest.xml [took 0s]
artifacts/Unit Test Results (Python 3.7)/pytest.xml [took 0s]
artifacts/Unit Test Results (Python 3.8)/pytest.xml [took 0s]
artifacts/Unit Test Results (Python 3.9)/pytest.xml [took 0s]
Raw output
azure.kusto.data.exceptions.KustoAuthenticationError: KustoAuthenticationError('AzureIdentityTokenProvider', 'ClientAuthenticationError("Authentication failed: 'NoneType' object has no attribute 'request'")', '{'credential': <azure.identity._credentials.default.DefaultAzureCredential object at 0x7fd32b858310>, 'resource': 'https://statusreturner.azurewebsites.net'}')
args = (<azure.identity._credentials.client_secret.ClientSecretCredential object at 0x7fd32b859250>, 'https://kusto.dev.kusto.windows.net/.default')
kwargs = {'claims': None, 'tenant_id': None}
auth_error = ClientAuthenticationError("Authentication failed: 'NoneType' object has no attribute 'request'")
@functools.wraps(fn)
def wrapper(*args, **kwargs):
try:
> return fn(*args, **kwargs)
../../../.local/lib/python3.11/site-packages/azure/identity/_internal/decorators.py:79:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../.local/lib/python3.11/site-packages/azure/identity/_internal/client_credential_base.py:40: in _request_token
result = app.acquire_token_for_client(list(scopes), claims_challenge=kwargs.pop("claims", None))
../../../.local/lib/python3.11/site-packages/msal/application.py:2119: in acquire_token_for_client
return _clean_up(self._acquire_token_silent_with_error(
../../../.local/lib/python3.11/site-packages/msal/application.py:1302: in _acquire_token_silent_with_error
result = self._acquire_token_silent_from_cache_and_possibly_refresh_it(
../../../.local/lib/python3.11/site-packages/msal/application.py:1430: in _acquire_token_silent_from_cache_and_possibly_refresh_it
result = self._acquire_token_for_client(
../../../.local/lib/python3.11/site-packages/msal/application.py:2138: in _acquire_token_for_client
response = client.obtain_token_for_client(
../../../.local/lib/python3.11/site-packages/msal/oauth2cli/oauth2.py:752: in obtain_token_for_client
return self._obtain_token("client_credentials", data=data, **kwargs)
../../../.local/lib/python3.11/site-packages/msal/oauth2cli/oidc.py:116: in _obtain_token
ret = super(Client, self)._obtain_token(grant_type, *args, **kwargs)
../../../.local/lib/python3.11/site-packages/msal/oauth2cli/oauth2.py:771: in _obtain_token
resp = super(Client, self)._obtain_token(
../../../.local/lib/python3.11/site-packages/msal/oauth2cli/oauth2.py:234: in _obtain_token
resp = (post or self._http_client.post)(
../../../.local/lib/python3.11/site-packages/msal/individual_cache.py:269: in wrapper
value = function(*args, **kwargs)
../../../.local/lib/python3.11/site-packages/msal/individual_cache.py:269: in wrapper
value = function(*args, **kwargs)
../../../.local/lib/python3.11/site-packages/azure/identity/_internal/msal_client.py:99: in post
response = self._pipeline.run(request, stream=False, retry_on_methods=_POST)
../../../.local/lib/python3.11/site-packages/azure/core/pipeline/_base.py:230: in run
return first_node.send(pipeline_request)
../../../.local/lib/python3.11/site-packages/azure/core/pipeline/_base.py:86: in send
response = self.next.send(request)
../../../.local/lib/python3.11/site-packages/azure/core/pipeline/_base.py:86: in send
response = self.next.send(request)
../../../.local/lib/python3.11/site-packages/azure/core/pipeline/_base.py:86: in send
response = self.next.send(request)
../../../.local/lib/python3.11/site-packages/azure/core/pipeline/_base.py:86: in send
response = self.next.send(request)
../../../.local/lib/python3.11/site-packages/azure/core/pipeline/policies/_retry.py:531: in send
response = self.next.send(request)
../../../.local/lib/python3.11/site-packages/azure/core/pipeline/_base.py:86: in send
response = self.next.send(request)
../../../.local/lib/python3.11/site-packages/azure/core/pipeline/_base.py:86: in send
response = self.next.send(request)
../../../.local/lib/python3.11/site-packages/azure/core/pipeline/_base.py:86: in send
response = self.next.send(request)
../../../.local/lib/python3.11/site-packages/azure/core/pipeline/_base.py:86: in send
response = self.next.send(request)
../../../.local/lib/python3.11/site-packages/azure/core/pipeline/_base.py:119: in send
self._sender.send(request.http_request, **request.context.options),
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <azure.core.pipeline.transport._requests_basic.RequestsTransport object at 0x7fd32b859b90>
request = <HttpRequest [POST], url: 'https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/oauth2/v2.0/token'>
kwargs = {'stream': False}, response = None, error = None
connection_timeout = 300, timeout = (300, 300), read_timeout = 300
def send(self, request: Union[HttpRequest, "RestHttpRequest"], **kwargs) -> Union[HttpResponse, "RestHttpResponse"]:
"""Send request object according to configuration.
:param request: The request object to be sent.
:type request: ~azure.core.pipeline.transport.HttpRequest
:return: An HTTPResponse object.
:rtype: ~azure.core.pipeline.transport.HttpResponse
:keyword requests.Session session: will override the driver session and use yours.
Should NOT be done unless really required. Anything else is sent straight to requests.
:keyword dict proxies: will define the proxy to use. Proxy is a dict (protocol, url)
"""
self.open()
response = None
error: Optional[AzureErrorUnion] = None
try:
connection_timeout = kwargs.pop("connection_timeout", self.connection_config.timeout)
if isinstance(connection_timeout, tuple):
if "read_timeout" in kwargs:
raise ValueError("Cannot set tuple connection_timeout and read_timeout together")
_LOGGER.warning("Tuple timeout setting is deprecated")
timeout = connection_timeout
else:
read_timeout = kwargs.pop("read_timeout", self.connection_config.read_timeout)
timeout = (connection_timeout, read_timeout)
> response = self.session.request( # type: ignore
request.method,
request.url,
headers=request.headers,
data=request.data,
files=request.files,
verify=kwargs.pop("connection_verify", self.connection_config.verify),
timeout=timeout,
cert=kwargs.pop("connection_cert", self.connection_config.cert),
allow_redirects=False,
**kwargs
)
E AttributeError: 'NoneType' object has no attribute 'request'
../../../.local/lib/python3.11/site-packages/azure/core/pipeline/transport/_requests_basic.py:343: AttributeError
The above exception was the direct cause of the following exception:
self = <azure.kusto.data.security._AadHelper object at 0x7fd3269c2bd0>
async def acquire_authorization_header_async(self):
try:
> return _get_header_from_dict(await self.token_provider.get_token_async())
../../../.local/lib/python3.11/site-packages/azure/kusto/data/security.py:88:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../.local/lib/python3.11/site-packages/azure/kusto/data/_token_providers.py:196: in get_token_async
return await _get_token_async()
../../../.local/lib/python3.11/site-packages/azure/core/tracing/decorator_async.py:77: in wrapper_use_tracer
return await func(*args, **kwargs)
../../../.local/lib/python3.11/site-packages/azure/kusto/data/_token_providers.py:190: in _get_token_async
token = await MonitoredActivity.invoke_async(
../../../.local/lib/python3.11/site-packages/azure/kusto/data/_telemetry.py:127: in invoke_async
return await span()
../../../.local/lib/python3.11/site-packages/azure/core/tracing/decorator_async.py:77: in wrapper_use_tracer
return await func(*args, **kwargs)
../../../.local/lib/python3.11/site-packages/azure/kusto/data/_token_providers.py:657: in _get_token_impl_async
t = await sync_to_async(self.credential.get_token)(self._scopes[0])
../../../.local/lib/python3.11/site-packages/asgiref/sync.py:479: in __call__
ret: _R = await loop.run_in_executor(
/opt/hostedtoolcache/Python/3.11.6/x64/lib/python3.11/concurrent/futures/thread.py:58: in run
result = self.fn(*self.args, **self.kwargs)
../../../.local/lib/python3.11/site-packages/asgiref/sync.py:538: in thread_handler
return func(*args, **kwargs)
../../../.local/lib/python3.11/site-packages/azure/identity/_credentials/default.py:219: in get_token
token = self._successful_credential.get_token(*scopes, claims=claims, tenant_id=tenant_id, **kwargs)
../../../.local/lib/python3.11/site-packages/azure/identity/_internal/decorators.py:33: in wrapper
token = fn(*args, **kwargs)
../../../.local/lib/python3.11/site-packages/azure/identity/_credentials/environment.py:151: in get_token
return self._credential.get_token(*scopes, claims=claims, tenant_id=tenant_id, **kwargs)
../../../.local/lib/python3.11/site-packages/azure/identity/_internal/get_token_mixin.py:86: in get_token
token = self._request_token(*scopes, claims=claims, tenant_id=tenant_id, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
args = (<azure.identity._credentials.client_secret.ClientSecretCredential object at 0x7fd32b859250>, 'https://kusto.dev.kusto.windows.net/.default')
kwargs = {'claims': None, 'tenant_id': None}
auth_error = ClientAuthenticationError("Authentication failed: 'NoneType' object has no attribute 'request'")
@functools.wraps(fn)
def wrapper(*args, **kwargs):
try:
return fn(*args, **kwargs)
except ClientAuthenticationError:
raise
except Exception as ex: # pylint:disable=broad-except
auth_error = ClientAuthenticationError(message="Authentication failed: {}".format(ex))
> raise auth_error from ex
E azure.core.exceptions.ClientAuthenticationError: Authentication failed: 'NoneType' object has no attribute 'request'
../../../.local/lib/python3.11/site-packages/azure/identity/_internal/decorators.py:84: ClientAuthenticationError
During handling of the above exception, another exception occurred:
self = <tests.test_e2e_data.TestE2E object at 0x7fd33ae5f0d0>, code = 308
@pytest.mark.asyncio
@pytest.mark.parametrize("code", [301, 302, 307, 308])
async def test_no_redirects_fail_in_client(self, code):
well_known_kusto_endpoints.add_trusted_hosts([MatchRule("statusreturner.azurewebsites.net", False)], False)
async with AsyncKustoClient(
KustoConnectionStringBuilder.with_azure_token_credential(f"https://statusreturner.azurewebsites.net/{code}/segment", self.async_cred)
) as client:
with pytest.raises(KustoServiceError) as ex:
> await client.execute("db", "table")
azure-kusto-data/tests/test_e2e_data.py:384:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../.local/lib/python3.11/site-packages/azure/kusto/data/aio/client.py:50: in execute
return await self.execute_query(database, query, properties)
../../../.local/lib/python3.11/site-packages/azure/core/tracing/decorator_async.py:77: in wrapper_use_tracer
return await func(*args, **kwargs)
../../../.local/lib/python3.11/site-packages/azure/kusto/data/aio/client.py:58: in execute_query
return await self._execute(self._query_endpoint, database, query, None, KustoClient._query_default_timeout, properties)
../../../.local/lib/python3.11/site-packages/azure/kusto/data/aio/client.py:145: in _execute
request_headers["Authorization"] = await self._aad_helper.acquire_authorization_header_async()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <azure.kusto.data.security._AadHelper object at 0x7fd3269c2bd0>
async def acquire_authorization_header_async(self):
try:
return _get_header_from_dict(await self.token_provider.get_token_async())
except Exception as error:
kwargs = await self.token_provider.context_async()
kwargs["resource"] = self.kusto_uri
> raise KustoAuthenticationError(self.token_provider.name(), error, **kwargs)
E azure.kusto.data.exceptions.KustoAuthenticationError: KustoAuthenticationError('AzureIdentityTokenProvider', 'ClientAuthenticationError("Authentication failed: 'NoneType' object has no attribute 'request'")', '{'credential': <azure.identity._credentials.default.DefaultAzureCredential object at 0x7fd32b858310>, 'resource': 'https://statusreturner.azurewebsites.net'}')
../../../.local/lib/python3.11/site-packages/azure/kusto/data/security.py:92: KustoAuthenticationError