microsoft-teams-apps
توضیحات
The app package for a Microsoft Teams agent
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | microsoft-teams-apps-2.1.1 |
| نام | microsoft-teams-apps |
| نسخه کتابخانه | 2.1.1 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | - |
| ایمیل نویسنده | Microsoft <TeamsAISDKFeedback@microsoft.com> |
| آدرس صفحه اصلی | - |
| آدرس اینترنتی | https://pypi.org/project/microsoft-teams-apps/ |
| مجوز | - |
# Microsoft Teams Apps Framework
<p>
<a href="https://pypi.org/project/microsoft-teams-apps" target="_blank">
<img src="https://img.shields.io/pypi/v/microsoft-teams-apps" />
</a>
<a href="https://pypi.org/project/microsoft-teams-apps" target="_blank">
<img src="https://img.shields.io/pypi/dw/microsoft-teams-apps" />
</a>
</p>
High-level framework for building Microsoft Teams applications.
Handles activity routing, authentication, and provides Microsoft Graph integration.
<a href="https://microsoft.github.io/teams-sdk" target="_blank">
<img src="https://img.shields.io/badge/📖 Getting Started-blue?style=for-the-badge" />
</a>
## Features
- **Activity Routing**: Decorator-based routing for different activity types
- **OAuth Integration**: Built-in OAuth flow handling for user authentication
- **Microsoft Graph Integration**: Type-safe Graph client access via `user_graph` and `app_graph` properties
- **Plugin System**: Extensible plugin architecture for adding functionality
## Basic Usage
```python
from microsoft_teams.apps import App, ActivityContext
from microsoft_teams.api import MessageActivity
app = App()
@app.on_message
async def handle_message(ctx: ActivityContext[MessageActivity]):
await ctx.send(f"You said: {ctx.activity.text}")
# Start the app
await app.start()
```
## Unauthenticated Requests
For local development only, JWT validation can be disabled explicitly:
```python
app = App(dangerously_allow_unauthenticated_requests=True)
```
It can also be enabled with the `DANGEROUSLY_ALLOW_UNAUTHENTICATED_REQUESTS=true` environment variable.
The previous `skip_auth` option is deprecated and remains supported for compatibility.
## OAuth and Graph Integration
```python
@app.on_message
async def handle_message(ctx: ActivityContext[MessageActivity]):
if ctx.is_signed_in:
try:
# Access user's Graph data
me = await ctx.user_graph.me.get()
await ctx.send(f"Hello {me.display_name}!")
except (ValueError, RuntimeError, ImportError) as e:
await ctx.send(f"Graph access failed: {e}")
else:
# Prompt user to sign in
await ctx.sign_in()
```
## Optional Graph Dependencies
Microsoft Graph functionality requires additional dependencies:
```bash
pip install microsoft-teams-apps[graph]
```
Or if using uv:
```bash
uv add microsoft-teams-apps[graph]
```
If Graph dependencies are not installed, `user_graph` and `app_graph` will raise an `ImportError` when accessed. If the user is not signed in or tokens are unavailable, they will raise `ValueError`.
نیازمندی
| مقدار | نام |
|---|---|
| - | cryptography>=50.0.0 |
| - | dependency-injector>=4.48.1 |
| - | fastapi>=0.115.13 |
| - | microsoft-teams-api>=2.1.1 |
| - | microsoft-teams-common>=2.1.1 |
| - | msal>=1.37.0 |
| - | opentelemetry-api>=1.41.0 |
| - | pydantic-settings>=2.11.0 |
| - | pyjwt[crypto]>=2.12.0 |
| - | python-dotenv>=1.0.0 |
| - | uvicorn>=0.34.3 |
| xtr | microsoft-teams-graph>=2.1.1; |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| <4.0,>=3.11 | Python |
نحوه نصب
نصب پکیج whl microsoft-teams-apps-2.1.1:
pip install microsoft-teams-apps.whl
نصب پکیج tar.gz microsoft-teams-apps-2.1.1:
pip install microsoft-teams-apps.tar.gz