跳转到主要内容

MagicBell的非官方Python SDK

项目描述

MagicBell-Python SDK

magicbell logo purple

此SDK为Python编写的应用程序提供了方便访问MagicBell REST API的方式。它包括创建通知、管理用户、管理项目和执行GraphQL的辅助工具。

CI codecov code coverage PyPI - License PyPI - Python Version PyPI Code style: black


这是一个由Noteable开源的非官方Python SDK,Noteable是一个协作笔记本平台,使团队能够共同使用和可视化数据,共同协作。

安装 | 入门 | 示例 | 许可证 | 行为准则 | 贡献

需求

Python 3.8+

安装

Poetry

poetry add magicbell

然后导入包

import magicbell

Pip

pip install magicbell

然后导入包

import magicbell

入门

import magicbell
from magicbell.configuration import Configuration

config = Configuration(
    api_key="YOUR_API_KEY",
    api_secret="YOUR_API_SECRET",
)
async with magicbell.MagicBell(config) as mb:
    # Send a notification
    await mb.realtime.create_notification(
        magicbell.WrappedNotification(
            notification=magicbell.Notification(
                title="My first notification from python!",
                recipients=[magicbell.Recipient(email="dan@example.com")],
            )
        )
    )

身份验证

大多数API调用需要您的MagicBell项目API密钥和API密钥。一些API调用(例如项目)需要您的MagicBell用户JWT(仅限企业)。

请参阅MagicBell API 文档以获取更多信息。

配置

配置可以通过使用magicbell.Configuration类明确完成,或者通过设置以MAGICBELL_前缀为前缀的环境变量隐式完成。

显式配置

from magicbell.configuration import Configuration


# Create a configuration object with the required parameters
config = Configuration(
    api_key="YOUR_API_KEY",
    api_secret="YOUR_API_SECRET",
)

隐式配置

export MAGICBELL_API_KEY="YOUR_API_KEY"
export MAGICBELL_API_SECRET="YOUR_API_SECRET"
from magicbell.configuration import Configuration


config = Configuration()

示例

更多示例请参阅examples目录

贡献

请参阅CONTRIBUTING.md


Noteable以❤️开源,为社区提供。

Boost Data Collaboration with Notebooks

项目详情


下载文件

下载适用于您的平台的文件。如果您不确定选择哪个,请了解更多关于安装包的信息。

源分发

magicbell-1.1.1.tar.gz (12.4 kB 查看哈希值)

上传时间

构建分发

magicbell-1.1.1-py3-none-any.whl (16.5 kB 查看哈希值)

上传时间 Python 3

支持者

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误日志 StatusPage StatusPage 状态页面