Skip to main content

Microsoft Graph client

Project description

llamazure.msgraph : Microsoft Graph client

The llamazure.azgraph package provides a usable client for the Microsoft Graph.

Benefits:

  • no boilerplate
  • easily navigate paginated queries

msgraph

Usage

Create a Graph with the from_credential and any of the standard Azure credentials.

from azure.identity import DefaultAzureCredential

from llamazure.msgraph.msgraph import Graph

g = Graph.from_credential(DefaultAzureCredential())

Querying

Make a simple query with the q method, which will return your data directly:

>>> g.q("me")
Res(req=Req(query='me', options=QueryOpts(count=None, expand=set(), filter=None, format=None, orderby=None, search=None, select=None, skip=None, top=None)), odata={'@odata.context': 'https://graph.microsoft.com/v1.0/$metadata#users/$entity'}, value={...}, nextLink=None)

Or specify options with the query method, which will return the full result object:

>>> from llamazure.msgraph.models import Req

>>> g.query(Req("me", options=QueryOpts(expand={"memberOf"})))
Res(req=Req(query='me', options=QueryOpts(count=None, expand={'memberOf'}, filter=None, format=None, orderby=None, search=None, select=None, skip=None, top=None)), odata={'@odata.context': 'https://graph.microsoft.com/v1.0/$metadata#users(memberOf())/$entity'}, value={...}, nextLink=None)

Retries

Every query can be automatically retried by the retry policy. You can modify this by setting the Graph.retry_policy attribute:

g.retry_policy = RetryPolicy(retries=10)

Pagination

Pagination is handled automatically. If you want to manually paginate, you can manually walk the pages:

req = Req(query="users")

res0 = g.query_single(req)
res1 = g.query_next(req, res0)
res2 = g.query_next(req, res1)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llamazure_msgraph-0.1.1.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llamazure_msgraph-0.1.1-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file llamazure_msgraph-0.1.1.tar.gz.

File metadata

  • Download URL: llamazure_msgraph-0.1.1.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for llamazure_msgraph-0.1.1.tar.gz
Algorithm Hash digest
SHA256 4426765171141c2ecb94a0e2dd1a3137a5df1abe2faf3919abbc6cd30486fd50
MD5 608bb40e2512926dd4228c37d861521c
BLAKE2b-256 08897f59937ab351c120319b903a47324abe85eae93493fc0a7f1722ee0ac8e6

See more details on using hashes here.

File details

Details for the file llamazure_msgraph-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for llamazure_msgraph-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e7d1e60d6c0323a0872ce10812264efcfa5beba94682959aa4da32273bab928d
MD5 a11f15716983413488a324bb3adb0f96
BLAKE2b-256 defe0104deae8813c5b67dfd95265dd89c52f9f971cb20af0cec3fe33fd6f6c6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page