-
Notifications
You must be signed in to change notification settings - Fork 84
Closed
Labels
priority:p2Medium. For a p2 bug, generally have a work-around. Bug SLA <=30 daysMedium. For a p2 bug, generally have a work-around. Bug SLA <=30 daystype:bugA broken experienceA broken experience
Description
Describe the bug
I am trying to get sites using with_url as first call, but an exception is thrown.
Expected behavior
No exception is thrown and the count of the sites is correct.
How to reproduce
import asyncio
import os
from azure.identity.aio import ClientSecretCredential
from msgraph import GraphServiceClient
credentials = ClientSecretCredential(
"TENANT_ID",
"CLIENT_ID",
"CLIENT_SECRET",
)
client = GraphServiceClient(credentials=credentials)
async def get_sites_with_url():
# workaround
# client.path_parameters["baseurl"] = client.request_adapter.base_url
print(f"Path parameters: {client.path_parameters}")
url = client.sites.to_get_request_information().url
print(f"Url: {url}")
sites = await client.sites.with_url(url).get()
print(f"#sites: {len(sites.value)}")
def main():
asyncio.run(get_sites_with_url())
if __name__ == "__main__":
main()SDK Version
1.14.0
Latest version known to work for scenario above?
No response
Known Workarounds
Add baseurl to the client.path_parameters after creating the client.
like so: client.path_parameters["baseurl"] = client.request_adapter.base_url
Debug output
Path parameters: {'base_url': 'https://graph.microsoft.com/v1.0'}
Url: /sites
Traceback (most recent call last):
File "/Users/luis.anselmo/projects/test.py", line 39, in <module>
main()
File "/Users/luis.anselmo/projects/test.py", line 35, in main
asyncio.run(get_sites_with_url())
File "/Users/luis.anselmo/.pyenv/versions/3.11.2/lib/python3.11/asyncio/runners.py", line 190, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "/Users/luis.anselmo/.pyenv/versions/3.11.2/lib/python3.11/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/luis.anselmo/.pyenv/versions/3.11.2/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/Users/luis.anselmo/projects/test.py", line 30, in get_sites_with_url
sites = await client.sites.with_url(url).get()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/luis.anselmo/.pyenv/versions/3.11.2/lib/python3.11/site-packages/msgraph/generated/sites/sites_request_builder.py", line 71, in get
return await self.request_adapter.send_async(request_info, SiteCollectionResponse, error_mapping)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/luis.anselmo/.pyenv/versions/3.11.2/lib/python3.11/site-packages/kiota_http/httpx_request_adapter.py", line 182, in send_async
response = await self.get_http_response_message(request_info, parent_span)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/luis.anselmo/.pyenv/versions/3.11.2/lib/python3.11/site-packages/kiota_http/httpx_request_adapter.py", line 532, in get_http_response_message
await self._authentication_provider.authenticate_request(
File "/Users/luis.anselmo/.pyenv/versions/3.11.2/lib/python3.11/site-packages/kiota_abstractions/authentication/base_bearer_token_authentication_provider.py", line 50, in authenticate_request
token = await self.access_token_provider.get_authorization_token(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/luis.anselmo/.pyenv/versions/3.11.2/lib/python3.11/site-packages/kiota_authentication_azure/azure_identity_access_token_provider.py", line 77, in get_authorization_token
raise exc
kiota_authentication_azure._exceptions.HTTPError: Valid url scheme and host required
Configuration
- OS: Mac 14.7.1 M1
- Python 3.11.2
Other information
No response
nikes, Mrfence97, jda5 and rafajot1
Metadata
Metadata
Assignees
Labels
priority:p2Medium. For a p2 bug, generally have a work-around. Bug SLA <=30 daysMedium. For a p2 bug, generally have a work-around. Bug SLA <=30 daystype:bugA broken experienceA broken experience