Cloudfare R2 customer service plugin, used to connect the R2 storage bucket
Project description
📖 介绍
cloudfare R2 客服端插件,用于连接R2存储桶,可以用作图床。
欢迎提issue。
💿 安装
使用 nb-cli 安装
在 nonebot2 项目的根目录下打开命令行, 输入以下指令即可安装nb plugin install nonebot-plugin-cfr2
使用包管理器安装
在 nonebot2 项目的插件目录下, 打开命令行, 根据你使用的包管理器, 输入相应的安装命令pip
pip install nonebot-plugin-cfr2
pdm
pdm add nonebot-plugin-cfr2
poetry
poetry add nonebot-plugin-cfr2
conda
conda install nonebot-plugin-cfr2
打开 nonebot2 项目根目录下的 pyproject.toml
文件, 在 [tool.nonebot]
部分追加写入
plugins = ["nonebot_plugin_cfr2"]
⚙️ 配置
在 nonebot2 项目的.env
文件中添加下表中的必填配置
配置项 | 必填 | 默认值 | 说明 |
---|---|---|---|
access_key | 是 | 无 | 应用密钥ID |
secret_key | 是 | 无 | 应用密钥 |
bucket_name | 是 | 无 | 桶名 |
region | 是 | 无 | 地区 |
endpoint_url | 是 | 无 | 自定义节点(请以https开头)(非Amazon必填) |
custom_domain | 否 | 无 | 自定义域名(请以https开头) |
🎉 使用
from nonebot import require
require("nonebot_plugin_cfr2")
from nonebot_plugin_cfr2 import uploader
# 上传文件
uploader.upload_file(str(image_file_path))
# 上传字节
uploader.upload_file_bytes(image_file_bytes, "jpg")
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for nonebot_plugin_cfr2-0.1.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3b605e44bef85e967ff20b742031389d47999aed4086232dd637ed1420941766 |
|
MD5 | 172bae52e10fb60d048aa62f2ce2abd2 |
|
BLAKE2b-256 | 4957edfefe022ce06ab15bb9729b86947ca6d4912979d5b284b8975a4b0b6d01 |
Close
Hashes for nonebot_plugin_cfr2-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5e598340ff9b75b5444d38a4670d022ad19f8b946cb681c65e9bc1d6b497b7a7 |
|
MD5 | bcd6df72b803af1f06d9d92d80d037e5 |
|
BLAKE2b-256 | 3693fab8cdb7bb65b3c5973eabfaa47ed3e51fff9c25402362c6872e2acc3994 |