{"id":8318,"library":"microsoft-kiota-bundle","title":"Microsoft Kiota Bundle","description":"microsoft-kiota-bundle is a convenience meta-package that installs all core Microsoft Kiota Python libraries. Kiota is a command-line tool for generating API clients based on OpenAPI descriptions. This bundle provides the necessary runtime components, including abstractions, authentication via Azure Identity, HTTP client implementations (based on Requests and Httpx), and serialization for JSON, Text, Form, and Multipart formats. The current version is 1.10.1, with releases typically synchronized across the Kiota Python ecosystem.","status":"active","version":"1.10.1","language":"en","source_language":"en","source_url":"https://github.com/microsoft/kiota-python","tags":["microsoft","kiota","api client","code generation","http client","authentication","serialization","bundle","openapi"],"install":[{"cmd":"pip install microsoft-kiota-bundle","lang":"bash","label":"Install all core Kiota Python components"},{"cmd":"pip install azure-identity requests","lang":"bash","label":"Install common external dependencies for usage"}],"dependencies":[{"reason":"Core interfaces and models for Kiota","package":"microsoft-kiota-abstractions","optional":false},{"reason":"Azure Active Directory authentication","package":"microsoft-kiota-authentication-azure","optional":false},{"reason":"HTTP client implementation (Requests and Httpx based)","package":"microsoft-kiota-http","optional":false},{"reason":"JSON serialization and deserialization","package":"microsoft-kiota-serialization-json","optional":false},{"reason":"Text serialization and deserialization","package":"microsoft-kiota-serialization-text","optional":false},{"reason":"Form serialization and deserialization","package":"microsoft-kiota-serialization-form","optional":false},{"reason":"Multipart form data serialization and deserialization","package":"microsoft-kiota-serialization-multipart","optional":false},{"reason":"Required for AzureIdentityAuthenticationProvider to work","package":"azure-identity","optional":false},{"reason":"Required for RequestsClient HTTP implementation","package":"requests","optional":false}],"imports":[{"symbol":"AzureIdentityAuthenticationProvider","correct":"from microsoft_kiota_authentication_azure.azure_identity_authentication_provider import AzureIdentityAuthenticationProvider"},{"symbol":"RequestsClient","correct":"from microsoft_kiota_http.requests_client import RequestsClient"},{"symbol":"RequestInformation","correct":"from microsoft_kiota_abstractions.request_information import RequestInformation"},{"symbol":"JsonSerializationWriterFactory","correct":"from microsoft_kiota_serialization_json.json_serialization_writer_factory import JsonSerializationWriterFactory"}],"quickstart":{"code":"import asyncio\nimport os\nfrom azure.identity import ClientSecretCredential\nfrom microsoft_kiota_authentication_azure.azure_identity_authentication_provider import AzureIdentityAuthenticationProvider\nfrom microsoft_kiota_http.requests_client import RequestsClient\nfrom microsoft_kiota_abstractions.request_information import RequestInformation\nfrom microsoft_kiota_abstractions.method import Method\nfrom microsoft_kiota_abstractions.base_request_configuration import BaseRequestConfiguration\n\n# --- Environment variables for Azure authentication ---\n# Replace with your actual values or set as environment variables\nTENANT_ID = os.environ.get('AZURE_TENANT_ID', 'YOUR_TENANT_ID')\nCLIENT_ID = os.environ.get('AZURE_CLIENT_ID', 'YOUR_CLIENT_ID')\nCLIENT_SECRET = os.environ.get('AZURE_CLIENT_SECRET', 'YOUR_CLIENT_SECRET')\n# Define the scopes required for your API calls\nSCOPES = [os.environ.get('AZURE_SCOPES', 'https://graph.microsoft.com/.default')]\n\nasync def main():\n    if not all([TENANT_ID, CLIENT_ID, CLIENT_SECRET]):\n        print(\"Please set AZURE_TENANT_ID, AZURE_CLIENT_ID, AZURE_CLIENT_SECRET environment variables (or hardcode for testing).\")\n        print(\"Using dummy values for demonstration, this will likely fail.\")\n        # Use dummy values to allow execution for demonstration purposes if env vars are missing\n        credential = ClientSecretCredential(\"dummy_tenant\", \"dummy_client\", \"dummy_secret\")\n    else:\n        # 1. Initialize Azure Identity credential\n        credential = ClientSecretCredential(\n            tenant_id=TENANT_ID,\n            client_id=CLIENT_ID,\n            client_secret=CLIENT_SECRET\n        )\n\n    # 2. Create an Azure Identity Authentication Provider\n    auth_provider = AzureIdentityAuthenticationProvider(\n        credential=credential,\n        scopes=SCOPES\n    )\n\n    # 3. Create an HTTP Client using the authentication provider\n    # The microsoft-kiota-bundle includes RequestsClient and HttpxClient\n    http_client = RequestsClient(authentication_provider=auth_provider)\n\n    # 4. Construct a Request Information object (typically done by a generated Kiota client)\n    request_info = RequestInformation()\n    request_info.http_method = Method.GET\n    request_info.url_template = \"https://graph.microsoft.com/v1.0/me\"\n    request_info.set_header(\"Accept\", \"application/json\")\n\n    print(f\"Attempting to make a GET request to: {request_info.url_template}\")\n    try:\n        # 5. Send the request and get the response\n        response = await http_client.send(request_info, BaseRequestConfiguration())\n\n        if response:\n            print(f\"Response Status: {response.status_code}\")\n            # For a real Kiota generated client, the response would be deserialized automatically.\n            # For demonstration, you might read the text content if successful.\n            if 200 <= response.status_code < 300:\n                body_content = await response.text()\n                print(f\"Response Body (truncated): {body_content[:500]}...\")\n            else:\n                print(f\"Error Response: {await response.text()}\")\n        else:\n            print(\"No response received.\")\n\n    except Exception as e:\n        print(f\"An error occurred during the request: {e}\")\n\nif __name__ == '__main__':\n    asyncio.run(main())\n","lang":"python","description":"This quickstart demonstrates how to set up core Kiota components using the `microsoft-kiota-bundle`. It initializes an `AzureIdentityAuthenticationProvider` for authentication (using `azure-identity` credentials), creates a `RequestsClient` for HTTP communication, and then uses Kiota's `RequestInformation` abstractions to make a simple GET request to Microsoft Graph. Note that in a real application, you would typically use a Kiota-generated client, which wraps these low-level components."},"warnings":[{"fix":"Upgrade your Python environment to version 3.10 or later (e.g., Python 3.11, 3.12).","message":"Support for Python 3.9 was dropped in `microsoft-kiota-bundle` version 1.10.0. Ensure your environment uses Python 3.10 or newer.","severity":"breaking","affected_versions":">=1.10.0"},{"fix":"Review your project's specific needs. If minimal dependencies are critical, install `microsoft-kiota-abstractions` and only the serialization/HTTP/authentication packages you actively use (e.g., `pip install microsoft-kiota-abstractions microsoft-kiota-serialization-json microsoft-kiota-http`).","message":"The `microsoft-kiota-bundle` package is a meta-package. While convenient, if you only need specific functionalities (e.g., only JSON serialization and no Azure authentication), you might prefer installing individual `microsoft-kiota-*` packages to reduce your dependency footprint.","severity":"gotcha","affected_versions":"All"},{"fix":"Familiarize yourself with the Kiota CLI and the client generation process. The generated client library will encapsulate much of the complexity, calling into the methods provided by this bundle.","message":"This bundle provides the *runtime* for Kiota-generated clients. The primary way to use Kiota is to first generate a client library from an OpenAPI description using the Kiota CLI. You typically won't interact directly with many of the bundle's components beyond setting up the `AuthenticationProvider` and `HttpClient`.","severity":"gotcha","affected_versions":"All"},{"fix":"Always install `azure-identity` and `requests` (or `httpx` if using `HttpxClient`) alongside the bundle: `pip install microsoft-kiota-bundle azure-identity requests`.","message":"While `microsoft-kiota-bundle` pulls in core Kiota dependencies, common external dependencies like `azure-identity` (for Azure authentication) and `requests` (for the default HTTP client) are not direct dependencies of the bundle itself but of its sub-packages. These still need to be installed for full functionality.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Install the `azure-identity` package: `pip install azure-identity`.","cause":"The `AzureIdentityAuthenticationProvider` relies on the `azure-identity` package, which is an external dependency not directly included in the `microsoft-kiota-bundle`.","error":"ModuleNotFoundError: No module named 'azure.identity'"},{"fix":"Install the `requests` package: `pip install requests`. If you intend to use `HttpxClient`, install `httpx` instead: `pip install httpx`.","cause":"While `microsoft-kiota-bundle` installs `microsoft-kiota-http`, the `RequestsClient` (or `HttpxClient`) implementation relies on the `requests` (or `httpx`) package, which might not be installed.","error":"ModuleNotFoundError: No module named 'microsoft_kiota_http.requests_client'"},{"fix":"Ensure you pass an instantiated authentication provider to the HTTP client: `http_client = RequestsClient(authentication_provider=your_auth_provider)`.","cause":"When initializing `RequestsClient` or `HttpxClient`, you must provide an `authentication_provider` instance, even if it's a `BaseAuthenticationProvider` (for unauthenticated calls).","error":"TypeError: __init__() missing 1 required positional argument: 'authentication_provider'"}]}