easy-clash-tool


Nameeasy-clash-tool JSON
Version 0.0.3 PyPI version JSON
download
home_pagehttps://easy-clash-tool.xink.top/
Summaryeasy_clash_tool是一个clash的python库,可以很便捷的自动切换可用节点
upload_time2024-04-17 13:51:46
maintainerNone
docs_urlNone
authorhanxinkong
requires_pythonNone
licenseMIT
keywords easy clash tool
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # easy-clash-tool

![PyPI - Python Version](https://img.shields.io/pypi/pyversions/easy-clash-tool)
![PyPI - Version](https://img.shields.io/pypi/v/easy-clash-tool)
![PyPI - License](https://img.shields.io/pypi/l/easy-clash-tool)
![PyPI - Format](https://img.shields.io/pypi/format/easy-clash-tool)
![GitHub watchers](https://img.shields.io/github/watchers/hanxinkong/easy-clash-tool)
![GitHub forks](https://img.shields.io/github/forks/hanxinkong/easy-clash-tool)
![GitHub Repo stars](https://img.shields.io/github/stars/hanxinkong/easy-clash-tool)

## 简介

easy_clash_tool是一个clash的python库,可以很便捷的自动切换可用节点,希望能为使用者带来益处。如果您也想贡献好的代码片段,请将代码以及描述,通过邮箱( [xinkonghan@gmail.com](mailto:hanxinkong<xinkonghan@gmail.com>)
)发送给我。代码格式是遵循自我主观,如存在不足敬请指出!

----
**文档地址:
** <a href="https://easy-clash-tool.xink.top/" target="_blank">https://easy-clash-tool.xink.top/ </a>

**PyPi地址:
** <a href="https://pypi.org/project/easy-clash-tool" target="_blank">https://pypi.org/project/easy-clash-tool </a>

**GitHub地址:
** [https://github.com/hanxinkong/easy-clash-tool](https://github.com/hanxinkong/easy-clash-tool)

----

## 安装

<div class="termy">

```console
pip install easy-clash-tool
```

</div>

## 简单使用

### demo.py

```python
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 | 否  | 安全密钥                                     |

命令行

```shell
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                           查看已选择代理
```

命令行示例

```shell
easy-clash --url http://127.0.0.1:24621 --secret 0367e21c-cceb-43a8-a2db-ad990e80dc28 --delay 10 --verify-url https://www.google.com
```

![img.png](res%2Fimg.png)

## 链接

Github:https://github.com/hanxinkong/easy-clash-tool

在线文档:https://easy-clash-tool.xink.top

## 贡献者

## 许可证

该项目根据 **MIT** 许可条款获得许可.

## 免责声明

1. 若使用者滥用本项目,本人 **无需承担** 任何法律责任.
2. 本程序仅供娱乐,源码全部开源,**禁止滥用** 和二次 **贩卖盈利**.  **禁止用于商业用途**.



            

Raw data

            {
    "_id": null,
    "home_page": "https://easy-clash-tool.xink.top/",
    "name": "easy-clash-tool",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "easy, clash, tool",
    "author": "hanxinkong",
    "author_email": "xinkonghan@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/a3/40/57bac14b9d414655db38d1cb6e95e47a7a37a9753b723b72db16f1989288/easy_clash_tool-0.0.3.tar.gz",
    "platform": null,
    "description": "# easy-clash-tool\r\n\r\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/easy-clash-tool)\r\n![PyPI - Version](https://img.shields.io/pypi/v/easy-clash-tool)\r\n![PyPI - License](https://img.shields.io/pypi/l/easy-clash-tool)\r\n![PyPI - Format](https://img.shields.io/pypi/format/easy-clash-tool)\r\n![GitHub watchers](https://img.shields.io/github/watchers/hanxinkong/easy-clash-tool)\r\n![GitHub forks](https://img.shields.io/github/forks/hanxinkong/easy-clash-tool)\r\n![GitHub Repo stars](https://img.shields.io/github/stars/hanxinkong/easy-clash-tool)\r\n\r\n## \u7b80\u4ecb\r\n\r\neasy_clash_tool\u662f\u4e00\u4e2aclash\u7684python\u5e93,\u53ef\u4ee5\u5f88\u4fbf\u6377\u7684\u81ea\u52a8\u5207\u6362\u53ef\u7528\u8282\u70b9\uff0c\u5e0c\u671b\u80fd\u4e3a\u4f7f\u7528\u8005\u5e26\u6765\u76ca\u5904\u3002\u5982\u679c\u60a8\u4e5f\u60f3\u8d21\u732e\u597d\u7684\u4ee3\u7801\u7247\u6bb5\uff0c\u8bf7\u5c06\u4ee3\u7801\u4ee5\u53ca\u63cf\u8ff0\uff0c\u901a\u8fc7\u90ae\u7bb1\uff08 [xinkonghan@gmail.com](mailto:hanxinkong<xinkonghan@gmail.com>)\r\n\uff09\u53d1\u9001\u7ed9\u6211\u3002\u4ee3\u7801\u683c\u5f0f\u662f\u9075\u5faa\u81ea\u6211\u4e3b\u89c2\uff0c\u5982\u5b58\u5728\u4e0d\u8db3\u656c\u8bf7\u6307\u51fa\uff01\r\n\r\n----\r\n**\u6587\u6863\u5730\u5740\uff1a\r\n** <a href=\"https://easy-clash-tool.xink.top/\" target=\"_blank\">https://easy-clash-tool.xink.top/ </a>\r\n\r\n**PyPi\u5730\u5740\uff1a\r\n** <a href=\"https://pypi.org/project/easy-clash-tool\" target=\"_blank\">https://pypi.org/project/easy-clash-tool </a>\r\n\r\n**GitHub\u5730\u5740\uff1a\r\n** [https://github.com/hanxinkong/easy-clash-tool](https://github.com/hanxinkong/easy-clash-tool)\r\n\r\n----\r\n\r\n## \u5b89\u88c5\r\n\r\n<div class=\"termy\">\r\n\r\n```console\r\npip install easy-clash-tool\r\n```\r\n\r\n</div>\r\n\r\n## \u7b80\u5355\u4f7f\u7528\r\n\r\n### demo.py\r\n\r\n```python\r\nimport time\r\nfrom easy_clash_tool.clash import Clash\r\n\r\nclash = Clash(\r\n    base_api='http://127.0.0.1:24621',\r\n    secret='0367e21c-cceb-43a8-a2db-ad990e80dc28',\r\n    group_name='',\r\n)\r\n\r\n# \u624b\u52a8\u5207\u6362\r\nnodes, selected = clash.get_proxies()\r\nprint(nodes)\r\nclash.change_node('\ud83c\udfae Steam \u5546\u5e97/\u793e\u533a')\r\n\r\n# \u81ea\u52a8\u5207\u6362\r\nwhile True:\r\n    clash.auto_switch()\r\n    time.sleep(10)\r\n\r\n```\r\n\r\n\u53c2\u6570\u8bf4\u660e\r\n\r\n| \u5b57\u6bb5\u540d           | \u7c7b\u578b     | \u5fc5\u987b | \u63cf\u8ff0                                       |\r\n|---------------|--------|----|------------------------------------------|\r\n| base_api      | string | \u5426  | clash_api\u5730\u5740\u7aef\u53e3\uff08\u9ed8\u8ba4: http://127.0.0.1:9090\uff09 |\r\n| group_name    | string | \u5426  | \u7b56\u7565\u7ec4\uff08\u9ed8\u8ba4: GLOBAL\uff09                          |\r\n| delay_timeout | string | \u5426  | \u8282\u70b9\u8d85\u65f6\u65f6\u95f4\uff08\u9ed8\u8ba4: 6\u79d2\uff09                           |\r\n| verify_url    | string | \u5426  | \u6d4b\u8bd5\u8d85\u65f6\u7684\u7ad9\u70b9\uff08\u9ed8\u8ba4: https://www.google.com\uff09      |\r\n| secret        | string | \u5426  | \u5b89\u5168\u5bc6\u94a5                                     |\r\n\r\n\u547d\u4ee4\u884c\r\n\r\n```shell\r\nusage: 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]\r\n               [--show-selected]\r\n\r\noptional arguments:\r\n  -h, --help                                    show this help message and exit\r\n  --url URL, -u URL                             clash-api \u53ef\u67e5\u770bconfig.yaml\u6587\u4ef6\r\n  --secret SECRET, -P SECRET                    \u5bc6\u7801\r\n  --delay DELAY, -T DELAY                       \u81ea\u52a8\u5207\u6362\u8282\u70b9\u95f4\u9694\u65f6\u95f4 \u5355\u4f4d:\u79d2\r\n  --node-timeout NODE_TIMEOUT, -t NODE_TIMEOUT  \u8282\u70b9\u8d85\u65f6\u65f6\u95f4 \u5355\u4f4d:\u79d2\r\n  --verify-url VERIFY_URL                       \u7528\u4e8e\u6d4b\u8bd5\u5ef6\u65f6\u7684url\r\n  --group_name GROUP_NAME                       \u6307\u5b9a\u7b56\u7565\u7ec4,\u53ef\u5148\u901a\u8fc7 --show-group\u53c2\u6570\u67e5\u8be2\u53ef\u7528\u7b56\u7565\u7ec4\r\n  --show-group, -g                              \u67e5\u770b\u6240\u6709\u7b56\u7565\u7ec4\r\n  --show-proxies, -p                            \u67e5\u770b\u6240\u6709\u4ee3\u7406\r\n  --show-selected, -s                           \u67e5\u770b\u5df2\u9009\u62e9\u4ee3\u7406\r\n```\r\n\r\n\u547d\u4ee4\u884c\u793a\u4f8b\r\n\r\n```shell\r\neasy-clash --url http://127.0.0.1:24621 --secret 0367e21c-cceb-43a8-a2db-ad990e80dc28 --delay 10 --verify-url https://www.google.com\r\n```\r\n\r\n![img.png](res%2Fimg.png)\r\n\r\n## \u94fe\u63a5\r\n\r\nGithub\uff1ahttps://github.com/hanxinkong/easy-clash-tool\r\n\r\n\u5728\u7ebf\u6587\u6863\uff1ahttps://easy-clash-tool.xink.top\r\n\r\n## \u8d21\u732e\u8005\r\n\r\n## \u8bb8\u53ef\u8bc1\r\n\r\n\u8be5\u9879\u76ee\u6839\u636e **MIT** \u8bb8\u53ef\u6761\u6b3e\u83b7\u5f97\u8bb8\u53ef.\r\n\r\n## \u514d\u8d23\u58f0\u660e\r\n\r\n1. \u82e5\u4f7f\u7528\u8005\u6ee5\u7528\u672c\u9879\u76ee,\u672c\u4eba **\u65e0\u9700\u627f\u62c5** \u4efb\u4f55\u6cd5\u5f8b\u8d23\u4efb.\r\n2. \u672c\u7a0b\u5e8f\u4ec5\u4f9b\u5a31\u4e50,\u6e90\u7801\u5168\u90e8\u5f00\u6e90,**\u7981\u6b62\u6ee5\u7528** \u548c\u4e8c\u6b21 **\u8d29\u5356\u76c8\u5229**.  **\u7981\u6b62\u7528\u4e8e\u5546\u4e1a\u7528\u9014**.\r\n\r\n\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "easy_clash_tool\u662f\u4e00\u4e2aclash\u7684python\u5e93,\u53ef\u4ee5\u5f88\u4fbf\u6377\u7684\u81ea\u52a8\u5207\u6362\u53ef\u7528\u8282\u70b9",
    "version": "0.0.3",
    "project_urls": {
        "Homepage": "https://easy-clash-tool.xink.top/"
    },
    "split_keywords": [
        "easy",
        " clash",
        " tool"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b49251db3950ea07f5a567b313b4df1a9868a5e3bba8010c08ff70b47ecdc5c7",
                "md5": "cb4277d655b61d6dec1de2ad2c668395",
                "sha256": "84ac9f18ab490456b68c3a67a50944a57fb71f043359d0d8369b8a8f1b14bdfe"
            },
            "downloads": -1,
            "filename": "easy_clash_tool-0.0.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "cb4277d655b61d6dec1de2ad2c668395",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 6515,
            "upload_time": "2024-04-17T13:51:45",
            "upload_time_iso_8601": "2024-04-17T13:51:45.792501Z",
            "url": "https://files.pythonhosted.org/packages/b4/92/51db3950ea07f5a567b313b4df1a9868a5e3bba8010c08ff70b47ecdc5c7/easy_clash_tool-0.0.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a34057bac14b9d414655db38d1cb6e95e47a7a37a9753b723b72db16f1989288",
                "md5": "6b2c2b8d815f4860bba99c3af10c3616",
                "sha256": "5985e32d5d00d4b4c485a9e748dc4d4b3e4ad2cdc607ced78e219d8654270369"
            },
            "downloads": -1,
            "filename": "easy_clash_tool-0.0.3.tar.gz",
            "has_sig": false,
            "md5_digest": "6b2c2b8d815f4860bba99c3af10c3616",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 6410,
            "upload_time": "2024-04-17T13:51:46",
            "upload_time_iso_8601": "2024-04-17T13:51:46.927890Z",
            "url": "https://files.pythonhosted.org/packages/a3/40/57bac14b9d414655db38d1cb6e95e47a7a37a9753b723b72db16f1989288/easy_clash_tool-0.0.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-17 13:51:46",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "easy-clash-tool"
}
        
Elapsed time: 0.25618s