|
3 | 3 | <!-- prettier-ignore --> |
4 | 4 | [)](https://pypi.org/project/beeper_desktop_api/) |
5 | 5 |
|
6 | | -The Beeper Desktop Python library provides convenient access to the Beeper Desktop REST API from any Python 3.8+ |
| 6 | +The Beeper Desktop Python library provides convenient access to the Beeper Desktop REST API from any Python 3.9+ |
7 | 7 | application. The library includes type definitions for all request params and response fields, |
8 | 8 | and offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx). |
9 | 9 |
|
| 10 | +## MCP Server |
| 11 | + |
| 12 | +Use the Beeper Desktop MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application. |
| 13 | + |
| 14 | +[](https://cursor.com/en-US/install-mcp?name=%40beeper%2Fdesktop-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBiZWVwZXIvZGVza3RvcC1tY3AiXSwiZW52Ijp7IkJFRVBFUl9BQ0NFU1NfVE9LRU4iOiJNeSBBY2Nlc3MgVG9rZW4ifX0) |
| 15 | +[](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22%40beeper%2Fdesktop-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40beeper%2Fdesktop-mcp%22%5D%2C%22env%22%3A%7B%22BEEPER_ACCESS_TOKEN%22%3A%22My%20Access%20Token%22%7D%7D) |
| 16 | + |
| 17 | +> Note: You may need to set environment variables in your MCP client. |
| 18 | +
|
10 | 19 | ## Documentation |
11 | 20 |
|
12 | 21 | The REST API documentation can be found on [developers.beeper.com](https://developers.beeper.com/desktop-api/). The full API of this library can be found in [api.md](api.md). |
13 | 22 |
|
14 | 23 | ## Installation |
15 | 24 |
|
16 | 25 | ```sh |
17 | | -# install from PyPI |
18 | | -pip install beeper_desktop_api |
| 26 | +# install from the production repo |
| 27 | +pip install git+ssh://git@github.com/beeper/desktop-api-python.git |
19 | 28 | ``` |
20 | 29 |
|
| 30 | +> [!NOTE] |
| 31 | +> Once this package is [published to PyPI](https://www.stainless.com/docs/guides/publish), this will become: `pip install beeper_desktop_api` |
| 32 | +
|
21 | 33 | ## Usage |
22 | 34 |
|
23 | 35 | The full API of this library can be found in [api.md](api.md). |
@@ -78,21 +90,24 @@ By default, the async client uses `httpx` for HTTP requests. However, for improv |
78 | 90 | You can enable this by installing `aiohttp`: |
79 | 91 |
|
80 | 92 | ```sh |
81 | | -# install from PyPI |
82 | | -pip install beeper_desktop_api[aiohttp] |
| 93 | +# install from the production repo |
| 94 | +pip install 'beeper_desktop_api[aiohttp] @ git+ssh://git@github.com/beeper/desktop-api-python.git' |
83 | 95 | ``` |
84 | 96 |
|
85 | 97 | Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`: |
86 | 98 |
|
87 | 99 | ```python |
| 100 | +import os |
88 | 101 | import asyncio |
89 | 102 | from beeper_desktop_api import DefaultAioHttpClient |
90 | 103 | from beeper_desktop_api import AsyncBeeperDesktop |
91 | 104 |
|
92 | 105 |
|
93 | 106 | async def main() -> None: |
94 | 107 | async with AsyncBeeperDesktop( |
95 | | - access_token="My Access Token", |
| 108 | + access_token=os.environ.get( |
| 109 | + "BEEPER_ACCESS_TOKEN" |
| 110 | + ), # This is the default and can be omitted |
96 | 111 | http_client=DefaultAioHttpClient(), |
97 | 112 | ) as client: |
98 | 113 | page = await client.chats.search( |
@@ -209,6 +224,23 @@ client.chats.reminders.create( |
209 | 224 | ) |
210 | 225 | ``` |
211 | 226 |
|
| 227 | +## File uploads |
| 228 | + |
| 229 | +Request parameters that correspond to file uploads can be passed as `bytes`, or a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance or a tuple of `(filename, contents, media type)`. |
| 230 | + |
| 231 | +```python |
| 232 | +from pathlib import Path |
| 233 | +from beeper_desktop_api import BeeperDesktop |
| 234 | + |
| 235 | +client = BeeperDesktop() |
| 236 | + |
| 237 | +client.assets.upload( |
| 238 | + file=Path("/path/to/file"), |
| 239 | +) |
| 240 | +``` |
| 241 | + |
| 242 | +The async client uses the exact same interface. If you pass a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance, the file contents will be read asynchronously automatically. |
| 243 | + |
212 | 244 | ## Handling errors |
213 | 245 |
|
214 | 246 | When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `beeper_desktop_api.APIConnectionError` is raised. |
@@ -460,7 +492,7 @@ print(beeper_desktop_api.__version__) |
460 | 492 |
|
461 | 493 | ## Requirements |
462 | 494 |
|
463 | | -Python 3.8 or higher. |
| 495 | +Python 3.9 or higher. |
464 | 496 |
|
465 | 497 | ## Contributing |
466 | 498 |
|
|
0 commit comments