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.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| microsoft_teams_common-2.2.0.tar.gz | 12.5 kB | Without provenance | Details for microsoft_teams_common-2.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| microsoft_teams_common-2.2.0-py3-none-any.whl | Python 3 | none | any | Details for microsoft_teams_common-2.2.0-py3-none-any.whl |
Total release size: 30.8 kB
Release files / microsoft_teams_common-2.2.0.tar.gz
| Download URL | microsoft_teams_common-2.2.0.tar.gz |
|---|---|
| Size | 12.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6e6018bab4fda2e55719a845cd4b524237d6765ff58bd25e4477faff57796e44
|
|
BLAKE2b-256 checksum How to use checksums |
b1b2266744806448c443a12c211f6033eb1ca69fd3b6b5f1454cb33e8c2daf28
|
| 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.0-py3-none-any.whl
| Download URL | microsoft_teams_common-2.2.0-py3-none-any.whl |
|---|---|
| Size | 18.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f2d68f176f76cddebdbcbc5ee14f7bdc05c8dc1d786afad8470fdd83bd0e0bcc
|
|
BLAKE2b-256 checksum How to use checksums |
4970ad2fa6ee669c020d473c63365479a9d185409c86c94c5a9de22ef22b2c2f
|
| 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.0
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.