Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Microsoft Teams Common Utilities

Shared utilities including HTTP client, logging, storage, and event handling. Provides common functionality used across other Teams SDK packages.

Features

  • HTTP Client: Async HTTP client with token support and interceptors
  • Event System: Type-safe event emitter for application lifecycle management
  • Storage: Local storage implementations for key-value and list data
  • Logging: Console logging with formatting and filtering

HTTP Client

from microsoft_teams.common import Client, ClientOptions

# Create HTTP client
client = Client(ClientOptions(
    base_url="https://api.example.com",
    headers={"User-Agent": "Teams-Bot/1.0"}
))

# Make requests
response = await client.get("/users/me")
data = await client.post("/messages", json={"text": "Hello"})

Event System

from microsoft_teams.common import EventEmitter

# Create type-safe event emitter
emitter = EventEmitter[str]()

# Register handler
def handle_message(data: str):
    print(f"Received: {data}")

subscription_id = emitter.on("message", handle_message)

# Emit event
emitter.emit("message", "Hello World")

# Remove handler
emitter.off(subscription_id)

Storage

from microsoft_teams.common import LocalStorage, ListLocalStorage

# Key-value storage
storage = LocalStorage[str]()
storage.set("key", {"data": "value"})
data = storage.get("key")

# Async operations
await storage.async_set("key", {"data": "value"})
data = await storage.async_get("key")

# List storage
list_storage = ListLocalStorage[str]()
list_storage.append("new-item")
items = list_storage.items()

Logging

The SDK uses Python's standard logging module. The library doesn't configure logging - your application should.

import logging

# Configure logging once at application startup
logging.getLogger().setLevel(logging.DEBUG)
stream_handler = logging.StreamHandler()
stream_handler.setFormatter(ConsoleFormatter())
logging.getLogger().addHandler(stream_handler)

# Use module-level loggers in your code
logger = logging.getLogger(__name__)
logger.info("Application started")

Custom Filtering

The SDK provides optional filtering as well:

stream_handler.addFilter(ConsoleFilter("microsoft_teams.*"))

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

microsoft_teams_common-2.1.0a1.tar.gz (12.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

microsoft_teams_common-2.1.0a1-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

Details for the file microsoft_teams_common-2.1.0a1.tar.gz.

File metadata

File hashes

Hashes for microsoft_teams_common-2.1.0a1.tar.gz
Algorithm Hash digest
SHA256 85aa223ff111b018c2575af784bd79032cd1312e4cd826151d5346459e7f6210
MD5 b0d4b8d2f708ddcfc900ed3720e35907
BLAKE2b-256 8fe2e0c0ff797b23ece255c844cba4340a4b24bbe2f98e96bb4e4bd453a50b39

See more details on using hashes here.

File details

Details for the file microsoft_teams_common-2.1.0a1-py3-none-any.whl.

File metadata

File hashes

Hashes for microsoft_teams_common-2.1.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 9b34b1747ba204bd3404085eb8281206f469fd62c24fd3c27ea82062373571b6
MD5 c3238618417aa8045c8c9c61bc067f6e
BLAKE2b-256 d0d86d1a8607127882cc49b06c2ef2993fe1d1f40811907aaf8eb429f7f055e8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page