msgraph-beta-sdk-python
msgraph-beta-sdk-python copied to clipboard
msgraph-beta-sdk-python calling v1.0 endpoint instead of beta after dependency update
Describe the bug
I suspect this is tied in with the issues noted in #741 and microsoftgraph/msgraph-sdk-python#1089 around kiota changes but I'm not exactly sure how.
Basically the issue is as the title - a number of scripts using msgraph-beta-sdk-python failed after updating some of the dependencies with pip. On investigation this appears to be because the request are being directed to https://graph.microsoft.com/v1.0/ instead of https://graph.microsoft.com/beta/
microsoftgraph/msgraph-sdk-python#1089 says msgraph-core 1.2.1 fixes that particular issue, but even with 1.2.1 this one remains
Expected behavior
The requests should go to https://graph.microsoft.com/beta/
How to reproduce
A fresh install with the latest versions from pip will replicate the issue:
msgraph-beta-sdk==1.19.0 msgraph-core==1.3.1 microsoft-kiota-abstractions==1.9.2 microsoft-kiota-authentication-azure==1.9.2 microsoft-kiota-http==1.9.2 microsoft-kiota-serialization-form==1.9.2 microsoft-kiota-serialization-json==1.9.2 microsoft-kiota-serialization-multipart==1.9.2 microsoft-kiota-serialization-text==1.9.2
Nothing special needs to be done to replicate the issue - create a GraphServiceClient and either try to use it or print out path_parameters['base_url'] and you will see it is using the v1.0 endpoint and not the beta one.
SDK Version
1.19.0
Latest version known to work for scenario above?
No response
Known Workarounds
Explicitly setting the base_url to https://graph.microsoft.com/beta/
Debug output
No response
Configuration
No response
Other information
No response
I'm facing this same issue (actually I started with an Ansible issue, and now I'm 3 issues deep in trying to add a Managed Identity to a group LOL) - msgraph_beta.GraphServicesClient calls the https://graph.microsoft.com/v1.0//groups/xxxxxxxxxxxxxxxxxxxxxxxxx/members endpoint. I only just noticed the two slashes in there.
BUT - how do you explicitly set the base url? I don't see any mention of it in the parameters for GraphServiceClient or any of it's base classes...
This looks like it changes it, but the resulting queries still go to the wrong URL
c = GraphServiceClient(self.azure_credential_track2)
print(c.path_parameters)
c.path_parameters['base_url'] = "https://graph.microsoft.com/beta/"
print(c.path_parameters)
return c
I've mostly switched away from this library as I wasn't impressed that something could be so fundamentally broken and they both didn't notice before release, and haven't seemed to show any interest in fixing it. However, looking back it seems like this workaround might work for you:
c.path_parameters['base_url'] = "https://graph.microsoft.com/beta"
c.request_adapter.base_url = "https://graph.microsoft.com/beta"
I can't remember why you need to set it in two different places anymore.
hehe thanks. I have to admit that my original take was that the combination of lightly-documented autogenerated query builder classes and async was massive overkill for my simple use case, and I wrote my own little client. The only reason I am here again is that Ansible uses it, too.
(the second (request_adapter) change does indeed switch it over)