Skip to main content

A Python Wrapper for DlerCloud API

Project description

Python DlerCloud API

这是什么

这是一个可用于调用 DlerCloud API 的非官方 Python 模块。

你可以用它实现自动节点筛选和配置更新等操作。

支持 Python 3.x,尚未验证 Python 2.x 中的兼容性。

怎么安装

使用 pip 安装:

pip3 install -U dlercloud

如何使用

DlerCloud 在其 Telegram 频道 中提供了 API 的简要说明。

本 Python 模块按照该说明进行构建。

API URL DlerCloudAPI()
登陆 /api/v1/login .login(email, password)
SS 节点列表 /api/v1/nodes/ss .nodes.ss()
V2ray 节点列表 /api/v1/nodes/v2ray .nodes.v2ray()
Clash SS 托管配置 /api/v1/managed/clash_ss .managed.clash_ss()
Clash V2ray 托管配置 /api/v1/managed/clash_v2 .managed.clash_v2()
SS 订阅地址 /api/v1/subscribe/ss .subscribe.ss()
SSD 订阅地址 /api/v1/subscribe/ssd .subscribe.ssd()
SSR 订阅地址 /api/v1/subscribe/ssr .subscribe.ssr()
V2RayN 的订阅地址 /api/v1/subscribe/av2 .subscribe.av2()
Quantumult V2ray 订阅地址 /api/v1/subscribe/qv2 .subscribe.qv2()
使当前 access token 失效 /api/v1/logout .logout()

示例代码

这些示例代码可以帮助你更好的理解:

from dlercloud import DlerCloudAPI

api = DlerCloudAPI()

# 使用邮箱和密码登录
api.login('your@email.com', 'YoUr*PasSwoRD')

# 若不想每次重复登陆,可将获得的 access_token 保存下来,
# 并在下次创建 DlerCloudAPI 实例时作为初始化参数传入,如:
# api = DlerCloudAPI('mYtOkEnAbCdEf0123456789')
# 目前 access_token 的有效期为 24 小时

# 例: 使用 SSNode 节点信息,创建一条 Surge 节点配置

# 获得 ss 节点列表
nodes = api.nodes.ss()
# [<SSNode: 节点 1>, <SSNode: 节点 2>, <SSNode: 节点 3>, ...]

node = nodes[0]
# <SSNode: 节点 1>

surge_node_conf = '''
{n.name} = ss, {n.server}, {n.port}, encrypt-method={n.cipher}, password={n.password}{o}{u}
'''.format(
    n=node,
    o=', obfs={}'.format(node.advanced['obfs'][12:])
    if node.advanced.get('obfs') not in ('plain', None) else '',
    u=', udp-relay=true' if node.udp else ''
).strip()

print(surge_node_conf)
# 节点 1 = ss, 1.2.3.4, 1234, encrypt-method=aes-256-gcm, password=abc123, obfs=tls, udp-relay=true

免责声明

本 Python 模块的作者并非 DlerCloud 网站或公司的人员,不参与 DlerCloud 的经营和建设,也并非其投资者。

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

dlercloud-0.0.8.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

dlercloud-0.0.8-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file dlercloud-0.0.8.tar.gz.

File metadata

  • Download URL: dlercloud-0.0.8.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.1.0 requests-toolbelt/0.9.1 tqdm/4.25.0 CPython/3.7.4

File hashes

Hashes for dlercloud-0.0.8.tar.gz
Algorithm Hash digest
SHA256 ded5a8dff63f32ee31ccbb6556a4e34b34ad157e40c0a08467b8fca5af262c97
MD5 d9265b2494d217d1099e5a20b87eba81
BLAKE2b-256 9048e3b014ce745793ccd8202b23645a9a01df3c67106bdd9aace6727cda0236

See more details on using hashes here.

File details

Details for the file dlercloud-0.0.8-py3-none-any.whl.

File metadata

  • Download URL: dlercloud-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.1.0 requests-toolbelt/0.9.1 tqdm/4.25.0 CPython/3.7.4

File hashes

Hashes for dlercloud-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 5180483a22a940bb297814d40fdfbf7d11aedfcab90fa25434c7807e5c63bddd
MD5 bf15b8d6097e8777a90d58bbf8c085a2
BLAKE2b-256 c05ec9ed007ec5952f754182b419a6342483325c199377c709b156704162e825

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page