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.0.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

llamazure.msgraph-0.1.0-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file llamazure.msgraph-0.1.0.tar.gz.

File metadata

  • Download URL: llamazure.msgraph-0.1.0.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.12

File hashes

Hashes for llamazure.msgraph-0.1.0.tar.gz
Algorithm Hash digest
SHA256 30d0c518ea7504e7fa8e59c24aeff13d9b9ee3e8da82d990c4341f1b18005712
MD5 7134c40a9538dfee93525a7edeafc8b5
BLAKE2b-256 76483439f3745a6201fdc2ac0d09b1859cc72c1ce064973c1422b76c87a9cb55

See more details on using hashes here.

File details

Details for the file llamazure.msgraph-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for llamazure.msgraph-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 60d9d8b0951964ee6cf7434ead6bdaa377b93d819532d274ae340ed095c2b458
MD5 3d9041ba7997768dbfe54b81e329d5d8
BLAKE2b-256 570120820892effe74fe14940ff9699e8d5ed600c3014f0716719e05a028b00e

See more details on using hashes here.

Supported by

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