Skip to content

BosnaZmaj/msgraph-sdk-python-core

 
 

Repository files navigation

Microsoft Graph Python Client Library

The Microsoft Graph Python client library is a lightweight wrapper around the Microsoft Graph API.

Getting Started

Install packages

  1. pip install -i https://test.pypi.org/simple/ msgraphcore
  2. pip install azure-identity

Import modules

from azure.identity import UsernamePasswordCredential, DeviceCodeCredential
from msgraphcore import GraphSession

Configure Credential Object

# Added UsernamePassword for demo purposes only, please don't use this in production.
# ugly_credential = UsernamePasswordCredential('set-clientId', 'set-username', 'set-password')

device_credential = DeviceCodeCredential(
    'set-clientId')

# There are many other options for getting an access token. See the following for more information.
# https://pypi.org/project/azure-identity/

Pass the credential object and scopes to the GraphSession constructor.

scopes = ['mail.send', 'user.read']
graph_session = GraphSession(device_credential, scopes)
result = graph_session.get('/me')
print(result.json())

About

Microsoft Graph client library for Python

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%