Microsoft Kiota HTTP

1.10.1 · active · verified Thu Apr 09

microsoft-kiota-http provides the core abstractions and implementations for making HTTP requests in Kiota-generated Python SDKs. It offers request adapters that integrate with popular HTTP clients like `requests` and `httpx`, handling the underlying network communication and request serialization/deserialization. The library is part of the broader Microsoft Kiota ecosystem, receiving frequent updates to synchronize with other Kiota packages.

Warnings

Install

Imports

Quickstart

This example demonstrates how to initialize a `RequestsRequestAdapter`, which is the entry point for making HTTP requests with a Kiota-generated client. It uses the `AnonymousAuthenticationProvider` for simplicity; real applications would use a production-ready authentication provider.

import os
from microsoft.kiota.authentication.anonymous.anonymous_authentication_provider import AnonymousAuthenticationProvider
from microsoft.kiota.http.requests_request_adapter import RequestsRequestAdapter

# 1. Initialize an AuthenticationProvider.
#    For real applications, you'd use a provider like AzureIdentityAuthenticationProvider.
auth_provider = AnonymousAuthenticationProvider()

# 2. Create a RequestAdapter using a Kiota HTTP client implementation.
#    RequestsRequestAdapter uses the 'requests' library by default.
#    Alternatively, use HttpxRequestAdapter for 'httpx'.
request_adapter = RequestsRequestAdapter(auth_provider)

# The 'request_adapter' can now be passed to a Kiota-generated API client.
# Example: my_client = MyGeneratedApiClient(request_adapter)

print("Kiota HTTP Request Adapter initialized successfully.")
print(f"Using adapter type: {type(request_adapter).__name__}")

# This quickstart does not perform an actual API call as it requires a generated client.

view raw JSON →