Skip to content

HTTPError: Valid url scheme and host required #1089

@maheshsonavane

Description

@maheshsonavane

Describe the bug

I am experiencing an error when attempting to retrieve user information from the API. This functionality was working as expected until yesterday, but I started encountering this issue this morning.

Image

Expected behavior

Should return list of all users

How to reproduce

from msgraph import GraphServiceClient
scopes = ['https://graph.microsoft.com/.default']
credential = ClientSecretCredential(TENANT_ID,
CLIENT_ID,
CLIENT_SECRET)
client = GraphServiceClient(credentials=credential, scopes=scopes)
graph_client = GraphServiceClient(credentials=credential, scopes=scopes)
result = await graph_client.users.get()

SDK Version

latest

Latest version known to work for scenario above?

No response

Known Workarounds

No response

Debug output

HTTPError: Valid url scheme and host required
File , line 8
6 client = GraphServiceClient(credentials=credential, scopes=scopes)
7 graph_client = GraphServiceClient(credentials=credential, scopes=scopes)
----> 8 result = await graph_client.users.get()
File /local_disk0/.ephemeral_nfs/cluster_libraries/python/lib/python3.11/site-packages/msgraph/generated/users/users_request_builder.py:73, in UsersRequestBuilder.get(self, request_configuration)
70 raise Exception("Http core is null")
71 from ..models.user_collection_response import UserCollectionResponse
---> 73 return await self.request_adapter.send_async(request_info, UserCollectionResponse, error_mapping)
File /local_disk0/.ephemeral_nfs/cluster_libraries/python/lib/python3.11/site-packages/kiota_http/httpx_request_adapter.py:186, in HttpxRequestAdapter.send_async(self, request_info, parsable_factory, error_map)
183 parent_span.record_exception(REQUEST_IS_NULL)
184 raise REQUEST_IS_NULL
--> 186 response = await self.get_http_response_message(request_info, parent_span)
188 response_handler = self.get_response_handler(request_info)
189 if response_handler:
File /local_disk0/.ephemeral_nfs/cluster_libraries/python/lib/python3.11/site-packages/kiota_http/httpx_request_adapter.py:595, in HttpxRequestAdapter.get_http_response_message(self, request_info, parent_span, claims)
592 if claims:
593 additional_authentication_context[self.CLAIMS_KEY] = claims
--> 595 await self._authentication_provider.authenticate_request(
596 request_info, additional_authentication_context
597 )
599 request = self.get_request_from_request_information(
600 request_info, _get_http_resp_span, parent_span
601 )
602 resp = await self._http_client.send(request)
File /local_disk0/.ephemeral_nfs/cluster_libraries/python/lib/python3.11/site-packages/kiota_abstractions/authentication/base_bearer_token_authentication_provider.py:50, in BaseBearerTokenAuthenticationProvider.authenticate_request(self, request, additional_authentication_context)
47 request.headers = HeadersCollection()
49 if not request.headers.contains(self.AUTHORIZATION_HEADER):
---> 50 token = await self.access_token_provider.get_authorization_token(
51 request.url, additional_authentication_context
52 )
53 if token:
54 request.headers.add(f'{self.AUTHORIZATION_HEADER}', f'Bearer {token}')
File /local_disk0/.ephemeral_nfs/cluster_libraries/python/lib/python3.11/site-packages/kiota_authentication_azure/azure_identity_access_token_provider.py:78, in AzureIdentityAccessTokenProvider.get_authorization_token(self, uri, additional_authentication_context)
76 exc = HTTPError("Valid url scheme and host required")
77 span.record_exception(exc)
---> 78 raise exc
80 if parsed_url.scheme != "https" and (parsed_url.hostname not in self.LOCALHOST_STRINGS):
81 span.set_attribute(self.IS_VALID_URL, False)

Configuration

No response

Other information

No response

Metadata

Metadata

Assignees

Labels

goodfirstissueStandard GitHub label used for easy to resolve issues targeting beginner contributorspriority:p2Medium. For a p2 bug, generally have a work-around. Bug SLA <=30 daystype:bugA broken experience

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions