No project description provided
Project description
nonebot_plugin_requests
✨ 封装 ForwardDriver 实现 HttpClient 功能 ✨
📖 介绍
本插件提供了 HttpClient 的封装, 简化了网络请求调用
💿 安装
使用 nb-cli 安装
在 nonebot2 项目的根目录下打开命令行, 输入以下指令即可安装nb plugin install nonebot-plugin-requests
使用包管理器安装
在 nonebot2 项目的插件目录下, 打开命令行, 根据你使用的包管理器, 输入相应的安装命令pip
pip install nonebot-plugin-requests
pdm
pdm add nonebot-plugin-requests
poetry
poetry add nonebot-plugin-requests
conda
conda install nonebot-plugin-requests
打开 nonebot2 项目根目录下的 pyproject.toml
文件, 在 [tool.nonebot]
部分追加写入
plugins = ["nonebot_plugin_example"]
⚙️ 配置
在 nonebot2 项目的.env
文件中添加下表中的配置
配置项 | 必填 | 默认值 | 说明 |
---|---|---|---|
nonebot_plugin_requests_enable_proxy | 否 | False | 是否使用代理 |
nonebot_plugin_requests_proxy_type | 否 | http | 代理类型(仅限http) |
nonebot_plugin_requests_proxy_address | 否 | 127.0.0.1 | 代理地址 |
nonebot_plugin_requests_proxy_port | 否 | 1081 | 代理端口 |
🎉 使用
参考示例如下:
import nonebot
nonebot.require("nonebot_plugin_requests")
from nonebot_plugin_requests import NonebotRequests
async def get_something():
request = NonebotRequests()
response = await request.get(...)
json = NonebotRequests.parse_content_json(response)
text = NonebotRequests.parse_content_text(response)
...
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
File details
Details for the file nonebot_plugin_requests-0.1.2.tar.gz
.
File metadata
- Download URL: nonebot_plugin_requests-0.1.2.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 23495a3b4b9898fba01b39a2a193dd95d6f3b50cd0a62debb1cc90f4fec3ca04 |
|
MD5 | 0e9262ed9bd3bacbb1eef77d952182f3 |
|
BLAKE2b-256 | 71b8f8cc3938f281a5cdc964dc929bb13e95101bd101ec12f37566c347d16e09 |
File details
Details for the file nonebot_plugin_requests-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: nonebot_plugin_requests-0.1.2-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 81224291350a7138c245bee6ea02a60c764bdee88e58993782de836846ee717c |
|
MD5 | 838a252119ab23c37b9b25b556fc23a1 |
|
BLAKE2b-256 | ebcc05ada2aaf4ddd4d61f2d77b4feb38b7940f348192504a8ef9225542ea934 |