Description
[](https://badge.fury.io/py/msgraph-core) [](https://github.com/microsoftgraph/msgraph-sdk-python-core/actions/workflows/build.yml) [](https://pepy.tech/project/msgraph-core) ## Microsoft Graph Core Python Client Library The Microsoft Graph Core Python Client Library contains core classes used by [Microsoft Graph Python Client Library](https://github.com/microsoftgraph/msgraph-sdk-python) to send native HTTP requests to [Microsoft Graph API](https://graph.microsoft.com). > NOTE: > This is a new major version of the Python Core library for Microsoft Graph based on the [Kiota](https://microsoft.github.io/kiota/) project. We recommend to use this library with the [full Python SDK](https://github.com/microsoftgraph/msgraph-sdk-python). > Upgrading to this version from the [previous version of the Python Core library](https://pypi.org/project/msgraph-core/0.2.2/) will introduce breaking changes into your application. ## Prerequisites Python 3.9+ This library doesn't support [older](https://devguide.python.org/versions/) versions of Python. ## Getting started ### 1. Register your application 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](https://docs.microsoft.com/en-us/graph/auth/auth-concepts) - [Register your app with the Microsoft identity platform](https://docs.microsoft.com/en-us/graph/auth-register-app-v2) ### 2. Install the required packages msgraph-core is available on PyPI. ```cmd pip3 install msgraph-core pip3 install azure-identity ``` ### 3. Configure an Authentication Provider Object An instance of the `BaseGraphRequestAdapter` class handles building client. To create a new instance of this class, you need to provide an instance of `AuthenticationProvider`, which can authenticate requests to Microsoft Graph. > **Note**: This client library 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`. For authentication you need to use one of the async credential classes from `azure.identity`. ```py # Using EnvironmentCredential 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/#async-credentials from azure.identity.aio import EnvironmentCredential from msgraph_core.authentication import AzureIdentityAuthenticationProvider credential=EnvironmentCredential() auth_provider = AzureIdentityAuthenticationProvider(credential) ``` > **Note**: `AzureIdentityAuthenticationProvider` sets the default scopes and allowed hosts. ### 5. Pass the authentication provider object to the BaseGraphRequestAdapter constructor ```python from msgraph_core import BaseGraphRequestAdapter adapter = BaseGraphRequestAdapter(auth_provider) ``` ### 6. Make a requests to the graph After you have a `BaseGraphRequestAdapter` that is authenticated, you can begin making calls against the service. ```python import asyncio from kiota_abstractions.request_information import RequestInformation request_info = RequestInformation() request_info.url = 'https://graph.microsoft.com/v1.0/me' # User is your own type that implements Parsable or comes from the service library user = asyncio.run(adapter.send_async(request_info, User, {})) print(user.display_name) ``` ## Telemetry Metadata This library captures metadata by default that provides insights into its usage and helps to improve the developer experience. This metadata includes the `SdkVersion`, `RuntimeEnvironment` and `HostOs` on which the client is running. ## Issues View or log issues on the [Issues](https://github.com/microsoftgraph/msgraph-sdk-python-core/issues) tab in the repo. ## Contributing Please see the [contributing guidelines](CONTRIBUTING.md). ## Copyright and license Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT [license](LICENSE). This 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.
Release History
| Version | Changes | Urgency | Date |
|---|---|---|---|
| 1.3.8 | Imported from PyPI (1.3.8) | Low | 4/21/2026 |
| v1.3.8 | ## [1.3.8](https://github.com/microsoftgraph/msgraph-sdk-python-core/compare/v1.3.7...v1.3.8) (2025-09-11) ### Bug Fixes * remove MIT License from project classifiers ([a15c2a1](https://github.com/microsoftgraph/msgraph-sdk-python-core/commit/a15c2a1f5ebeaad2a5e0806c0d8801608f35f49a)) | Low | 9/11/2025 |
| v1.3.7 | ## [1.3.7](https://github.com/microsoftgraph/msgraph-sdk-python-core/compare/v1.3.6...v1.3.7) (2025-09-11) ### Bug Fixes * dependabot update of core deps ([6f8d997](https://github.com/microsoftgraph/msgraph-sdk-python-core/commit/6f8d997f0e52482868969121ad06961ec28ba98a)) | Low | 9/11/2025 |
| v1.3.6 | ## [1.3.6](https://github.com/microsoftgraph/msgraph-sdk-python-core/compare/v1.3.5...v1.3.6) (2025-08-05) ### Bug Fixes * Update license field to use proper SPDX identifier ([c91fafd](https://github.com/microsoftgraph/msgraph-sdk-python-core/commit/c91fafd15466c74102f0f01b5bb6740222edbf99)) | Low | 8/5/2025 |
| v1.3.5 | ## [1.3.5](https://github.com/microsoftgraph/msgraph-sdk-python-core/compare/v1.3.4...v1.3.5) (2025-06-27) ### Bug Fixes * BatchRequestItem now properly serializes the header and body fields ([7b5ad11](https://github.com/microsoftgraph/msgraph-sdk-python-core/commit/7b5ad1130f16438579e160aaea1d3aae000b96b6)) * GraphClientFactory baseUrl setting logic ([5377bba](https://github.com/microsoftgraph/msgraph-sdk-python-core/commit/5377bbafdfbd68d9467bf12c1ccdb40e13c4e374)) | Low | 6/27/2025 |
| v1.3.4 | ## [1.3.4](https://github.com/microsoftgraph/msgraph-sdk-python-core/compare/v1.3.3...v1.3.4) (2025-06-02) ### Bug Fixes * dependecy conflict ([914da4f](https://github.com/microsoftgraph/msgraph-sdk-python-core/commit/914da4fc7c5a65a80fbf2411cc5ab4cf333a5e14)) | Low | 6/2/2025 |
| v1.3.3 | ## [1.3.3](https://github.com/microsoftgraph/msgraph-sdk-python-core/compare/v1.3.2...v1.3.3) (2025-03-24) ### Bug Fixes * sequencing of batches ([9e14ea3](https://github.com/microsoftgraph/msgraph-sdk-python-core/commit/9e14ea3bb3126df47a62ed026ecbd5af471a15e3)) | Low | 3/24/2025 |
| v1.3.2 | ## [1.3.2](https://github.com/microsoftgraph/msgraph-sdk-python-core/compare/v1.3.1...v1.3.2) (2025-02-25) ### Bug Fixes * Batch building bugs ([#837](https://github.com/microsoftgraph/msgraph-sdk-python-core/issues/837)) ([a0dd3c1](https://github.com/microsoftgraph/msgraph-sdk-python-core/commit/a0dd3c18d39f9cadbba25109345ee7be8a810a99)) | Low | 2/25/2025 |
| v1.3.1 | ## [1.3.1](https://github.com/microsoftgraph/msgraph-sdk-python-core/compare/v1.3.0...v1.3.1) (2025-02-06) ### Bug Fixes * bump kiota dependencies ([#827](https://github.com/microsoftgraph/msgraph-sdk-python-core/issues/827)) ([466b5c1](https://github.com/microsoftgraph/msgraph-sdk-python-core/commit/466b5c119851debfcf5a1ab6d36f145abc36caaf)) | Low | 2/6/2025 |
| v1.3.0 | ## [1.3.0](https://github.com/microsoftgraph/msgraph-sdk-python-core/compare/v1.2.1...v1.3.0) (2025-02-03) ### Features * adds support for python 3.13 ([b972a20](https://github.com/microsoftgraph/msgraph-sdk-python-core/commit/b972a2073cd7d272455161209da4f031b50e7a2d)) | Low | 2/3/2025 |
| v1.2.1 | ## [1.2.1](https://github.com/microsoftgraph/msgraph-sdk-python-core/compare/v1.2.0...v1.2.1) (2025-01-30) ### Bug Fixes * issue with national cloud/version enums and base url being set [#818](https://github.com/microsoftgraph/msgraph-sdk-python-core/issues/818) ([4ee7887](https://github.com/microsoftgraph/msgraph-sdk-python-core/commit/4ee78873cfe176c38e84c4f1d7f469c73eb6dff6)) | Low | 1/30/2025 |
| v1.2.0 | ## [1.2.0](https://github.com/microsoftgraph/msgraph-sdk-python-core/compare/v1.1.8...v1.2.0) (2025-01-14) ### Features * drop support for python 3.8 and drops deprecated type aliases ([d5d925e](https://github.com/microsoftgraph/msgraph-sdk-python-core/commit/d5d925e35d1a3a20be3e106ee55ec253d1599ebd)) ### Bug Fixes * drop support for python 3.8 and drops deprecated type aliases ([8c11aaf](https://github.com/microsoftgraph/msgraph-sdk-python-core/commit/8c11aaf50f9b62bca2b863b0881dc3ccde7e9 | Low | 1/14/2025 |
| v1.1.8 | ## [1.1.8](https://github.com/microsoftgraph/msgraph-sdk-python-core/compare/v1.1.7...v1.1.8) (2024-12-18) ### Bug Fixes * Fixes type hints and failing mypy checks ([85e8935](https://github.com/microsoftgraph/msgraph-sdk-python-core/commit/85e8935971adef13d4f5d1e55970c570ad267dda)) | Low | 12/18/2024 |
| v1.1.7 | ## [1.1.7](https://github.com/microsoftgraph/msgraph-sdk-python-core/compare/v1.1.6...v1.1.7) (2024-11-21) ### Bug Fixes * depends_on and batch request with content collection ([9d4153a](https://github.com/microsoftgraph/msgraph-sdk-python-core/commit/9d4153a1b0ce29ed0213f81bb4bd3191125304e5)) | Low | 11/21/2024 |
| v1.1.6 | ## [1.1.6](https://github.com/microsoftgraph/msgraph-sdk-python-core/compare/v1.1.5...v1.1.6) (2024-10-18) ### Bug Fixes * removes the tests directory from the package ([3d919a7](https://github.com/microsoftgraph/msgraph-sdk-python-core/commit/3d919a7f88c82bcebcbe093d9606906b56e0b416)) * removes the tests directory from the package ([ccbed8d](https://github.com/microsoftgraph/msgraph-sdk-python-core/commit/ccbed8df3a9d9165b81f2f8af80282eeb2814907)) | Low | 10/18/2024 |
| v1.1.5 | ## [1.1.5](https://github.com/microsoftgraph/msgraph-sdk-python-core/compare/v1.1.4...v1.1.5) (2024-10-02) ### Bug Fixes * release please initial configuration ([e781cd8](https://github.com/microsoftgraph/msgraph-sdk-python-core/commit/e781cd81156622b59a5b3c48fdf70995379d08a0)) | Low | 10/2/2024 |
| v1.1.4 | ## [1.1.4](https://github.com/microsoftgraph/msgraph-sdk-python-core/compare/v1.1.3...v1.1.4) (2024-09-24) ### Bug Fixes * Use abstractions request adapter in tasks ([6d390a2](https://github.com/microsoftgraph/msgraph-sdk-python-core/commit/6d390a2a5dea74d137f907cabf8b520100c5b1a8)) | Low | 9/24/2024 |
| v1.1.3 | ## [1.1.3](https://github.com/microsoftgraph/msgraph-sdk-python-core/compare/v1.1.2...v1.1.3) (2024-09-03) ### Bug Fixes * remove print statements from upload code. ([353d72d](https://github.com/microsoftgraph/msgraph-sdk-python-core/commit/353d72da513e0c5b809d31a8d921de0a0bde10be)) | Low | 9/3/2024 |
| v1.1.2 | ## [1.1.2](https://github.com/microsoftgraph/msgraph-sdk-python-core/compare/v1.1.1...v1.1.2) (2024-07-12) ### Bug Fixes * adds missing whitespace for suppressions ([7ad013e](https://github.com/microsoftgraph/msgraph-sdk-python-core/commit/7ad013e52190ab607dfe82c86ae68c87e7abe4cc)) * fixes exception configuration in pylint ([857ad99](https://github.com/microsoftgraph/msgraph-sdk-python-core/commit/857ad9950a0200dbe69d4b96052725624fbe8833)) * linting fix import ordering ([b56cc8d](https://gith | Low | 7/12/2024 |
| v1.1.1 | ## [1.1.1](https://github.com/microsoftgraph/msgraph-sdk-python-core/compare/v1.1.0...v1.1.1) (2024-07-10) ### Bug Fixes * avoid using default mutable parameters ([9fa773a](https://github.com/microsoftgraph/msgraph-sdk-python-core/commit/9fa773a7ca92f916a6eb593f033322d5a1918a10)) * fixes constants path for release please config ([2ff4440](https://github.com/microsoftgraph/msgraph-sdk-python-core/commit/2ff4440a18347feb173a40010ab4d9910717c6b6)) | Low | 7/10/2024 |
| v1.1.0 | ## [1.1.0](https://github.com/microsoftgraph/msgraph-sdk-python-core/compare/v1.0.1...v1.1.0) (2024-06-19) ### Features * adds support for python 3.12 ([991a5e0](https://github.com/microsoftgraph/msgraph-sdk-python-core/commit/991a5e0bc2ea4db108a127a1d079967b97ae1280)) ### Bug Fixes * replaces older contributing rst by md version ([70f6fb2](https://github.com/microsoftgraph/msgraph-sdk-python-core/commit/70f6fb25e612b7d01abba27c6c43ca43f166dcbf)) | Low | 6/19/2024 |
| v1.0.1 | Added -Page Iterator support -Large file Uploads | Low | 6/19/2024 |
| v1.0.0 | ### Added ### Changed - GA release. | Low | 1/22/2024 |
| v0.3.0-preview | ## What's Changed * Allow post requests without content-type header by @samwelkanda in https://github.com/microsoftgraph/msgraph-sdk-python-core/pull/109 * Task/kiota core migration by @samwelkanda in https://github.com/microsoftgraph/msgraph-sdk-python-core/pull/142 * Task/kiota core dependency by @samwelkanda in https://github.com/microsoftgraph/msgraph-sdk-python-core/pull/141 * Task/refactor packaging by @samwelkanda in https://github.com/microsoftgraph/msgraph-sdk-python-core/pull/144 | Low | 11/23/2022 |
| v0.2.2 | # Notes * Update version on PyPI # Changes * d14eda5 Release v0.2.2 * fb3929c Update sdk version | Low | 7/27/2021 |
| v0.2.1 | # Notes ## Bugfix Refactors the GraphClient implementation to allow passing middleware options as well as optional kwargs such as `stream=True` # Changes * c88b1a1 Release v0.2.1 * 2ae58f6 Remove unnecessary placeholder variables * 80efb76 Install dev dependencies for CI tests * 0e106d0 Configure CI to use environment variables * 5d9704d Refactor graph client to avoid preparing request * 2045d3b Support auth argument for use in non-graph requests * d125c27 Fix bug o | Low | 7/27/2021 |
| v0.2.0 | # Notes Main features * Retry handling * Request metadata through telemetry handler * Use requests version 2.26.0 # Changes * e8a95c0 Release v0.2.0 * 522b505 Update sdk version to 0.2.0 * 6af9bbc Update requests version to fix vulnerability with urllib3 * 43e3c53 Switch from test to main pypi * 7e8be20 Remove no longer needed .pypyrc * 7bef6bd Update release workflow and release template * ebb01c1 Update package publishing workflow * f5af5fd Add workflows to au | Low | 7/16/2021 |
| 0.1.2 | This is the initial development release of the Microsoft Graph Python Core SDK developed according to the [Microsoft Graph SDK design](https://github.com/microsoftgraph/msgraph-sdk-design). The initial feature list includes: * Support for [Azure Identity TokenCredential](https://docs.microsoft.com/en-us/python/api/overview/azure/identity-readme?view=azure-python) with Authorization middleware. * [HttpClientFactory](https://github.com/microsoftgraph/msgraph-sdk-design/blob/master/GraphClientF | Low | 6/10/2021 |
| 0.1.0 | This is the initial development release of the Microsoft Graph Python Core SDK developed according to the [Microsoft Graph SDK design](https://github.com/microsoftgraph/msgraph-sdk-design). The initial feature list includes: * Support for [Azure Identity TokenCredential](https://docs.microsoft.com/en-us/python/api/overview/azure/identity-readme?view=azure-python) with Authorization middleware. * [HttpClientFactory](https://github.com/microsoftgraph/msgraph-sdk-design/blob/master/GraphClientF | Low | 6/4/2021 |
