easy-clash-tool
简介
easy_clash_tool是一个clash的python库,可以很便捷的自动切换可用节点,希望能为使用者带来益处。如果您也想贡献好的代码片段,请将代码以及描述,通过邮箱( xinkonghan@gmail.com )发送给我。代码格式是遵循自我主观,如存在不足敬请指出!
**文档地址: ** https://easy-clash-tool.xink.top/
**PyPi地址: ** https://pypi.org/project/easy-clash-tool
**GitHub地址: ** https://github.com/hanxinkong/easy-clash-tool
安装
pip install easy-clash-tool
简单使用
demo.py
import time
from easy_clash_tool.clash import Clash
clash = Clash(
base_api='http://127.0.0.1:24621',
secret='0367e21c-cceb-43a8-a2db-ad990e80dc28',
group_name='',
)
# 手动切换
nodes, selected = clash.get_proxies()
print(nodes)
clash.change_node('🎮 Steam 商店/社区')
# 自动切换
while True:
clash.auto_switch()
time.sleep(10)
参数说明
| 字段名 | 类型 | 必须 | 描述 |
|---|---|---|---|
| base_api | string | 否 | clash_api地址端口(默认: http://127.0.0.1:9090) |
| group_name | string | 否 | 策略组(默认: GLOBAL) |
| delay_timeout | string | 否 | 节点超时时间(默认: 6秒) |
| verify_url | string | 否 | 测试超时的站点(默认: https://www.google.com) |
| secret | string | 否 | 安全密钥 |
命令行
usage: easy-clash [-h] [--url URL] [--secret SECRET] [--delay DELAY] [--node-delay NODE_DELAY] [--verify-url VERIFY_URL] [--group_name GROUP_NAME] [--show-group] [--show-proxies]
[--show-selected]
optional arguments:
-h, --help show this help message and exit
--url URL, -u URL clash-api 可查看config.yaml文件
--secret SECRET, -P SECRET 密码
--delay DELAY, -T DELAY 自动切换节点间隔时间 单位:秒
--node-timeout NODE_TIMEOUT, -t NODE_TIMEOUT 节点超时时间 单位:秒
--verify-url VERIFY_URL 用于测试延时的url
--group_name GROUP_NAME 指定策略组,可先通过 --show-group参数查询可用策略组
--show-group, -g 查看所有策略组
--show-proxies, -p 查看所有代理
--show-selected, -s 查看已选择代理
命令行示例
easy-clash --url http://127.0.0.1:24621 --secret 0367e21c-cceb-43a8-a2db-ad990e80dc28 --delay 10 --verify-url https://www.google.com
链接
Github:https://github.com/hanxinkong/easy-clash-tool
在线文档:https://easy-clash-tool.xink.top
贡献者
许可证
该项目根据 MIT 许可条款获得许可.
免责声明
- 若使用者滥用本项目,本人 无需承担 任何法律责任.
- 本程序仅供娱乐,源码全部开源,禁止滥用 和二次 贩卖盈利. 禁止用于商业用途.
Metadata
Release files for easy-clash-tool 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| easy_clash_tool-0.0.3.tar.gz | 6.4 kB | Without provenance | Details for easy_clash_tool-0.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| easy_clash_tool-0.0.3-py3-none-any.whl | Python 3 | none | any | Details for easy_clash_tool-0.0.3-py3-none-any.whl |
Total release size: 12.9 kB
Release files / easy_clash_tool-0.0.3.tar.gz
| Download URL | easy_clash_tool-0.0.3.tar.gz |
|---|---|
| Size | 6.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5985e32d5d00d4b4c485a9e748dc4d4b3e4ad2cdc607ced78e219d8654270369
|
|
BLAKE2b-256 checksum How to use checksums |
a34057bac14b9d414655db38d1cb6e95e47a7a37a9753b723b72db16f1989288
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.9.12
|
Release files / easy_clash_tool-0.0.3-py3-none-any.whl
| Download URL | easy_clash_tool-0.0.3-py3-none-any.whl |
|---|---|
| Size | 6.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
84ac9f18ab490456b68c3a67a50944a57fb71f043359d0d8369b8a8f1b14bdfe
|
|
BLAKE2b-256 checksum How to use checksums |
b49251db3950ea07f5a567b313b4df1a9868a5e3bba8010c08ff70b47ecdc5c7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.9.12
|
Security for easy-clash-tool 0.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.