Skip to main content

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.*"))

Metadata

Release files for microsoft-teams-common 2.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for microsoft-teams-common 2.2.1
File Size Uploaded Provenance Actions
microsoft_teams_common-2.2.1.tar.gz 12.5 kB Without provenance Details for microsoft_teams_common-2.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for microsoft-teams-common 2.2.1
File Interpreter ABI Platform Actions
microsoft_teams_common-2.2.1-py3-none-any.whl Python 3 none any Details for microsoft_teams_common-2.2.1-py3-none-any.whl

Total release size: 30.8 kB

Release files / microsoft_teams_common-2.2.1.tar.gz

Download URL microsoft_teams_common-2.2.1.tar.gz
Size 12.5 kB
Tags Source
SHA-256 checksum
How to use checksums
0b4cad5f4c0282339b2a870b1560d0fbde549a9eeb0ea099c165c802e00a72cd
BLAKE2b-256 checksum
How to use checksums
a64a62d08f2a8c774002f19638c93988fa93fcbb79d90145ef782479eab8d8fe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via RestSharp/106.13.0.0

Release files / microsoft_teams_common-2.2.1-py3-none-any.whl

Download URL microsoft_teams_common-2.2.1-py3-none-any.whl
Size 18.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b9fae6686bd786dde5621c79717e07cf1def1517bfb741fe83a59167825b56b1
BLAKE2b-256 checksum
How to use checksums
1ef5730404417dab47ecc26a3ccfeb1641a4e122622372e9dbfc855a596d1886
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via RestSharp/106.13.0.0

Security for microsoft-teams-common 2.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2.2.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page