我想通过 python 调用 clash restful api 但是报错连接失败 大家能帮我看看是什么问题吗,找不到原因
下面是我的 clash 配置文件和 python 代码
参考了这个链接: https://clash.gitbook.io/doc/restful-api
clash:
mixed-port: 7890
allow-lan: true
bind-address: '*'
mode: global
log-level: info
external-controller: '127.0.0.1:9090'
secret: 29c0c9ba-1740-42c0-bb8c-dd316c5d1e4a
python:
import requests
url = 'http://127.0.0.1:9090/proxies'
secret = "29c0c9ba-1740-42c0-bb8c-dd316c5d1e4a"
headers = {
'Authorization': f'Bearer {secret}'
}
print(requests.get(url, headers=headers).json())
报错: requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=9090): Max retries exceeded with url: /proxies (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x10580fb90>: Failed to establish a new connection: [Errno 61] Connection refused'))
我的网络状态是正常的,clash 也能正常使用,但是 restful api 调用不了,大家有什么解决思路吗,先谢谢了
1
guanzhangzhang 82 天前
你抓包和 curl -v 看看呢
|