The Microsoft Graph Core Python client library is a lightweight wrapper around the Microsoft Graph API. It provides functionality to create clients with desired configuration and middleware.
Python 3.5+ (this library doesn't support older versions of Python)
To call Microsoft Graph, your app must acquire an access token from the Microsoft identity platform. Learn more about this -
- Authentication and authorization basics for Microsoft Graph
- Register your app with the Microsoft identity platform
`pip install msgraph-core`
`pip install azure-identity`
from azure.identity import InteractiveBrowserCredential
from msgraph.core import GraphClient# Using InteractiveBrowserCredential for demonstration purposes.
# There are many other options for getting an access token. See the following for more information.
# https://pypi.org/project/azure-identity/
browser_credential = InteractiveBrowserCredential(client_id='YOUR_CLIENT_ID')client = GraphClient(credential=browser_credential)result = client.get('/me')
print(result.json())For more information on how to use the package, refer to the samples
View or log issues on the Issues tab in the repo.
Please see the contributing guidelines
Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT license.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.