{"id":28524830,"url":"https://github.com/microsoftgraph/msgraph-sdk-python","last_synced_at":"2026-04-17T20:02:20.558Z","repository":{"id":63719776,"uuid":"534665999","full_name":"microsoftgraph/msgraph-sdk-python","owner":"microsoftgraph","description":null,"archived":false,"fork":false,"pushed_at":"2025-12-18T05:05:21.000Z","size":102407,"stargazers_count":554,"open_issues_count":103,"forks_count":83,"subscribers_count":20,"default_branch":"main","last_synced_at":"2025-12-20T14:33:36.437Z","etag":null,"topics":["devxeng"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/microsoftgraph.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-09-09T14:00:17.000Z","updated_at":"2025-12-19T07:01:36.000Z","dependencies_parsed_at":"2025-10-30T23:37:09.851Z","dependency_job_id":null,"html_url":"https://github.com/microsoftgraph/msgraph-sdk-python","commit_stats":null,"previous_names":[],"tags_count":58,"template":false,"template_full_name":null,"purl":"pkg:github/microsoftgraph/msgraph-sdk-python","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoftgraph%2Fmsgraph-sdk-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoftgraph%2Fmsgraph-sdk-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoftgraph%2Fmsgraph-sdk-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoftgraph%2Fmsgraph-sdk-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/microsoftgraph","download_url":"https://codeload.github.com/microsoftgraph/msgraph-sdk-python/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoftgraph%2Fmsgraph-sdk-python/sbom","scorecard":{"id":519023,"data":{"date":"2025-08-11","repo":{"name":"github.com/microsoftgraph/msgraph-sdk-python","commit":"0fe51f759ba0bf9446fead7367dc481a43845560"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":7.2,"checks":[{"name":"Maintained","score":10,"reason":"30 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":10,"reason":"all changesets reviewed","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Security-Policy","score":10,"reason":"security policy file detected","details":["Info: security policy file detected: SECURITY.md:1","Info: Found linked content: SECURITY.md:1","Info: Found disclosure, vulnerability, and/or timelines in security policy: SECURITY.md:1","Info: Found text in security policy: SECURITY.md:1"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Info: jobLevel 'actions' permission set to 'read': .github/workflows/codeql.yml:34","Info: jobLevel 'contents' permission set to 'read': .github/workflows/codeql.yml:35","Warn: topLevel 'contents' permission set to 'write': .github/workflows/auto-merge-dependabot.yml:9","Warn: no topLevel permission defined: .github/workflows/build.yml:1","Warn: no topLevel permission defined: .github/workflows/codeql.yml:1","Info: topLevel 'contents' permission set to 'read': .github/workflows/conflicting-pr-label.yml:16","Warn: no topLevel permission defined: .github/workflows/project-auto-add.yml:1","Warn: no topLevel permission defined: .github/workflows/publish.yml:1","Info: topLevel 'contents' permission set to 'read': .github/workflows/validate-public-api-surface.yml:11","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":10,"reason":"SAST tool is run on all commits","details":["Info: SAST configuration detected: CodeQL","Info: all commits (30) are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: third-party GitHubAction not pinned by hash: .github/workflows/auto-merge-dependabot.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/microsoftgraph/msgraph-sdk-python/auto-merge-dependabot.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/microsoftgraph/msgraph-sdk-python/build.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/microsoftgraph/msgraph-sdk-python/build.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql.yml:49: update your workflow using https://app.stepsecurity.io/secureworkflow/microsoftgraph/msgraph-sdk-python/codeql.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql.yml:53: update your workflow using https://app.stepsecurity.io/secureworkflow/microsoftgraph/msgraph-sdk-python/codeql.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql.yml:67: update your workflow using https://app.stepsecurity.io/secureworkflow/microsoftgraph/msgraph-sdk-python/codeql.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql.yml:80: update your workflow using https://app.stepsecurity.io/secureworkflow/microsoftgraph/msgraph-sdk-python/codeql.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/conflicting-pr-label.yml:28: update your workflow using https://app.stepsecurity.io/secureworkflow/microsoftgraph/msgraph-sdk-python/conflicting-pr-label.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/project-auto-add.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/microsoftgraph/msgraph-sdk-python/project-auto-add.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/microsoftgraph/msgraph-sdk-python/publish.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/microsoftgraph/msgraph-sdk-python/publish.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/validate-public-api-surface.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/microsoftgraph/msgraph-sdk-python/validate-public-api-surface.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/validate-public-api-surface.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/microsoftgraph/msgraph-sdk-python/validate-public-api-surface.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/validate-public-api-surface.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/microsoftgraph/msgraph-sdk-python/validate-public-api-surface.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/validate-public-api-surface.yml:28: update your workflow using https://app.stepsecurity.io/secureworkflow/microsoftgraph/msgraph-sdk-python/validate-public-api-surface.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/validate-public-api-surface.yml:37: update your workflow using https://app.stepsecurity.io/secureworkflow/microsoftgraph/msgraph-sdk-python/validate-public-api-surface.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/validate-public-api-surface.yml:44: update your workflow using https://app.stepsecurity.io/secureworkflow/microsoftgraph/msgraph-sdk-python/validate-public-api-surface.yml/main?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/build.yml:27","Warn: pipCommand not pinned by hash: .github/workflows/build.yml:28","Warn: pipCommand not pinned by hash: .github/workflows/publish.yml:27","Info:   0 out of  12 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   5 third-party GitHubAction dependencies pinned","Info:   0 out of   3 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}}]},"last_synced_at":"2025-08-20T02:30:03.019Z","repository_id":63719776,"created_at":"2025-08-20T02:30:03.020Z","updated_at":"2025-08-20T02:30:03.020Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28675336,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-22T20:48:19.482Z","status":"ssl_error","status_checked_at":"2026-01-22T20:48:14.968Z","response_time":144,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["devxeng"],"created_at":"2025-06-09T11:11:41.768Z","updated_at":"2026-01-23T00:00:14.156Z","avatar_url":"https://github.com/microsoftgraph.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Microsoft Graph SDK for Python\n\n[![PyPI version](https://badge.fury.io/py/msgraph-sdk.svg)](https://badge.fury.io/py/msgraph-sdk)\n[![Downloads](https://pepy.tech/badge/msgraph-sdk)](https://pepy.tech/project/msgraph-sdk)\n[![Supported Versions](https://img.shields.io/pypi/pyversions/msgraph-sdk.svg)](https://pypi.org/project/msgraph-sdk)\n[![Contributors](https://img.shields.io/github/contributors/microsoftgraph/msgraph-sdk-python.svg)](https://github.com/microsoftgraph/msgraph-sdk-python/graphs/contributors)\n\nGet started with the Microsoft Graph SDK for Python by integrating the [Microsoft Graph API](https://docs.microsoft.com/graph/overview) into your Python application.\n\n\u003e **Note:**\n\u003e\n\u003e * This SDK allows you to build applications using the [v1.0](https://docs.microsoft.com/graph/use-the-api#version) of Microsoft Graph. If you want to try the latest Microsoft Graph APIs, try the [beta](https://github.com/microsoftgraph/msgraph-beta-sdk-python) SDK.  \n\n## 1. Installation\n\n```py\npip install msgraph-sdk\n```\n\n\u003e **Note:**\n\u003e\n\u003e * The Microsoft Graph SDK for Python is a fairly large package. It may take a few minutes for the initial installation to complete.\n\u003e * Enable long paths in your environment if you receive a `Could not install packages due to an OSError`. For details, see [Enable Long Paths in Windows 10, Version 1607, and Later](https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=powershell#enable-long-paths-in-windows-10-version-1607-and-later).\n\n## 2. Getting started with Microsoft Graph\n\n### 2.1 Register your application\n\nRegister your application by following the steps at [Register your app with the Microsoft Identity Platform](https://docs.microsoft.com/graph/auth-register-app-v2).\n\n### 2.2 Select and create an authentication provider\n\nTo start writing code and making requests to the Microsoft Graph service, you need to set up an authentication provider. This object will authenticate your requests to Microsoft Graph. For authentication, the Microsoft Graph Python SDK supports both sync and async credential classes from Azure Identity. Which library to choose depends on the type of application you are building.\n\n\u003e **Note**: For authentication we support both `sync` and `async` credential classes from `azure.identity`. Please see the azure identity [docs](https://learn.microsoft.com/en-us/python/api/azure-identity/azure.identity?view=azure-python) for more information.\n\nThe easiest way to filter this decision is by looking at the permissions set you'd use. Microsoft Graph supports 2 different types of permissions: delegated and application permissions:\n\n* Application permissions are used when you don’t need a user to login to your app, but the app will perform tasks on its own and run in the background.\n* Delegated permissions, also called scopes, are used when your app requires a user to login and interact with data related to this user in a session.\n\nThe following table lists common libraries by permissions set.\n| MSAL library | Permissions set | Common use case |\n|---|---|---|\n| [ClientSecretCredential](https://learn.microsoft.com/en-us/python/api/azure-identity/azure.identity.aio.clientsecretcredential?view=azure-python\u0026preserve-view=true) | Application permissions | Daemon apps or applications running in the background without a signed-in user. |\n| [DeviceCodeCredential](https://learn.microsoft.com/en-us/python/api/azure-identity/azure.identity.devicecodecredential?view=azure-python) | Delegated permissions | Enviroments where authentication is triggered in one machine and completed in another e.g in a cloud server. |\n| [InteractiveBrowserCredentials](https://learn.microsoft.com/en-us/python/api/azure-identity/azure.identity.interactivebrowsercredential?view=azure-python) | Delegated permissions | Environments where a browser is available and the user wants to key in their username/password. |\n| [AuthorizationCodeCredentials](https://learn.microsoft.com/en-us/python/api/azure-identity/azure.identity.authorizationcodecredential?view=azure-python) | Delegated permissions | Usually for custom customer applications where the frontend calls the backend and waits for the authorization code at a particular url. |\n\nYou can also use [EnvironmentCredential](https://learn.microsoft.com/en-us/python/api/azure-identity/azure.identity.environmentcredential?view=azure-python), [DefaultAzureCredential](https://learn.microsoft.com/en-us/python/api/azure-identity/azure.identity.defaultazurecredential?view=azure-python), [OnBehalfOfCredential](https://learn.microsoft.com/en-us/python/api/azure-identity/azure.identity.onbehalfofcredential?view=azure-python), or any other [Azure Identity library](https://learn.microsoft.com/en-us/python/api/overview/azure/identity-readme?view=azure-python#credential-classes).\n\nOnce you've picked an authentication library, we can initiate the authentication provider in your app. The following example uses ClientSecretCredential with application permissions.\n\n```python\nimport asyncio\n\nfrom azure.identity.aio import ClientSecretCredential\n\ncredential = ClientSecretCredential(\"tenantID\",\n                                    \"clientID\",\n                                    \"clientSecret\")\nscopes = ['https://graph.microsoft.com/.default']\n```\n\nThe following example uses DeviceCodeCredentials with delegated permissions.\n\n```python\nimport asyncio\n\nfrom azure.identity import DeviceCodeCredential\n\ncredential = DeviceCodeCredential(\"client_id\",\n                                  \"tenant_id\")\nscopes = ['https://graph.microsoft.com/.default']\n```\n\n### 2.3 Initialize a GraphServiceClient object\n\nYou must create **GraphServiceClient** object to make requests against the service. To create a new instance of this class, you need to provide credentials and scopes, which can authenticate requests to Microsoft Graph.\n\n```py\n# Example using async credentials and application access.\nfrom azure.identity.aio import ClientSecretCredential\nfrom msgraph import GraphServiceClient\n\ncredentials = ClientSecretCredential(\n    'TENANT_ID',\n    'CLIENT_ID',\n    'CLIENT_SECRET',\n)\nscopes = ['https://graph.microsoft.com/.default']\nclient = GraphServiceClient(credentials=credentials, scopes=scopes)\n```\n\nThe above example uses default scopes for [app-only access](https://learn.microsoft.com/en-us/graph/permissions-overview?tabs=http#application-permissions).  If using [delegated access](https://learn.microsoft.com/en-us/graph/permissions-overview#delegated-permissions) you can provide custom scopes:\n\n```py\n# Example using sync credentials and delegated access.\nfrom azure.identity import DeviceCodeCredential\nfrom msgraph import GraphServiceClient\n\ncredentials = DeviceCodeCredential(\n    'CLIENT_ID',\n    'TENANT_ID',\n)\nscopes = ['https://graph.microsoft.com/.default']\nclient = GraphServiceClient(credentials=credentials, scopes=scopes)\n```\n\n\u003e **Note**: Refer to the [following documentation page](https://learn.microsoft.com/graph/sdks/customize-client?tabs=python#configuring-the-http-proxy-for-the-client) if you need to configure an HTTP proxy.\n\n## 3. Make requests against the service\n\nAfter you have a **GraphServiceClient** that is authenticated, you can begin making calls against the service. The requests against the service look like our [REST API](https://docs.microsoft.com/graph/api/overview?view=graph-rest-1.0).\n\n\u003e **Note**: This SDK offers an asynchronous API by default. Async is a concurrency model that is far more efficient than multi-threading, and can provide significant performance benefits and enable the use of long-lived network connections such as WebSockets. We support popular python async environments such as `asyncio`, `anyio` or `trio`.\n\nThe following is a complete example that shows how to fetch a user from Microsoft Graph.\n\n```py\nimport asyncio\nfrom azure.identity.aio import ClientSecretCredential\nfrom msgraph import GraphServiceClient\n\ncredential = ClientSecretCredential(\n    'tenant_id',\n    'client_id',\n    'client_secret'\n)\nscopes = ['https://graph.microsoft.com/.default']\nclient = GraphServiceClient(credentials=credential, scopes=scopes)\n\n# GET /users/{id | userPrincipalName}\nasync def get_user():\n    user = await client.users.by_user_id('userPrincipalName').get()\n    if user:\n        print(user.display_name)\nasyncio.run(get_user())\n```\n\nNote that to calling `me` requires a signed-in user and therefore delegated permissions. See [Authenticating Users](https://learn.microsoft.com/en-us/python/api/overview/azure/identity-readme?view=azure-python#authenticate-users) for more:\n\n```py\nimport asyncio\nfrom azure.identity import InteractiveBrowserCredential\nfrom msgraph import GraphServiceClient\n\ncredential = InteractiveBrowserCredential(\n    client_id=os.getenv('client_id'),\n    tenant_id=os.getenv('tenant_id'),\n)\nscopes = [\"User.Read\"]\nclient = GraphServiceClient(credentials=credential, scopes=scopes,)\n\n# GET /me\nasync def me():\n    me = await client.me.get()\n    if me:\n        print(me.display_name)\nasyncio.run(me())\n```\n\n### 3.1 Error Handling\n\nFailed requests raise `APIError` exceptions. You can handle these exceptions using `try` `catch` statements.\n\n```py\nfrom kiota_abstractions.api_error import APIError\nasync def get_user():\n    try:\n        user = await client.users.by_user_id('userID').get()\n        print(user.user_principal_name, user.display_name, user.id)\n    except APIError as e:\n        print(f'Error: {e.error.message}')\nasyncio.run(get_user())\n```\n\n### 3.2 Pagination\n\nBy default a maximum of 100 rows are returned but in the response if odata_next_link is present, it can be used to fetch the next batch of max 100 rows. Here's an example to fetch the initial rows of members in a group, then iterate over the pages of rows using the odata_next_link\n\n```py\n        # get group members\n        members = await client.groups.by_group_id(id).members.get()\n        if members:\n            print(f\"########## Members:\")\n            for i in range(len(members.value)):\n                print(f\"display_name: {members.value[i].display_name}, mail: {members.value[i].mail}, id: {members.value[i].id}\")\n\n        # iterate over result batches \u003e 100 rows\n        while members is not None and members.odata_next_link is not None:\n            members = await client.groups.by_group_id(id).members.with_url(members.odata_next_link).get()\n            if members:\n                print(f\"########## Members:\")\n                for i in range(len(members.value)):\n                    print(f\"display_name: {members.value[i].display_name}, mail: {members.value[i].mail}, id: {members.value[i].id}\")\n```\n\n## Documentation and resources\n\n* [Overview](https://docs.microsoft.com/graph/overview)\n\n* [Microsoft Graph website](https://aka.ms/graph)\n\n* [Samples](docs)\n\n### Update Schedule\n\nThe Microsoft Graph .NET Client Library is scheduled to be updated during the second and fourth week of each month\n\n## Upgrading\n\nFor detailed information on breaking changes, bug fixes and new functionality introduced during major upgrades, check out our [Upgrade Guide](UPGRADING.md)\n\n## Issues\n\nView or log issues on the [Issues](https://github.com/microsoftgraph/msgraph-sdk-python/issues) tab in the repo.\n\n## Contribute\n\nPlease read our [Contributing](CONTRIBUTING.md) guidelines carefully for advice on how to contribute to this repo.\n\n## Copyright and license\n\nCopyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT [license](LICENSE).\n\nThis project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.\n\n## Third Party Notices\n\n[Third-party notices](THIRD%20PARTY%20NOTICES)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrosoftgraph%2Fmsgraph-sdk-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmicrosoftgraph%2Fmsgraph-sdk-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrosoftgraph%2Fmsgraph-sdk-python/lists"}