Skip to main content

域名解析记录管理工具

Project description

dnscli

DNS 命令行工具,支持域名解析记录的增删改查。 现已适配以下DNS服务商

安装

pip install dnscli

命令说明

  • alidns: 阿里云 DNS 命令行工具
  • dnspod: 腾讯云 DNS 命令行工具

使用说明

以 alidns 为例,其他命令使用方式类似

  1. 配置 API 信息
    alidns configure --secret-id xxxxx --secret-key xxxxx
    
  2. 查看域名列表
    alidns list-domain
    +------+---------------+--------------+--------+
    | 序号 | 域名           | 创建时间       | 记录数  |
    +------+---------------+--------------+--------+
    | 1    | test1.com     | 1592393820.0 | 9      |
    | 2    | test2.com     | 1592393160.0 | 6      |
    | 3    | test.cn       | 1448347860.0 | 14     |
    +------+---------------+--------------+--------+
    
  3. 查看域名解析记录
    alidns list test.cn
    +------+--------+----------+-------------------------------------+---------+-----+--------------------+--------------+--------------+
    | 序号 | 子域名 | 记录类型 | 记录值                              | 线路    | TTL | 记录 ID            | 创建时间     | 更新时间     |
    +------+--------+----------+-------------------------------------+---------+-----+--------------------+--------------+--------------+
    | 1    | tt     | AAAA     | ::12                                | default | 600 | 913272411669522432 | 1724317196.0 | 1724317196.0 |
    | 2    | wfga   | CNAME    | www.baidu.com                       | default | 600 | 913225766055557120 | 1724294954.0 | 1724311099.0 |
    +------+--------+----------+-------------------------------------+---------+-----+--------------------+--------------+--------------+
    
  4. 添加域名解析记录
    alidns create test.cn -n abc -v 1.2.3.4
    +------+--------+----------+---------+---------+-----+----------+
    | 序号 | 子域名 | 记录类型 | 记录值  | 线路    | TTL | 执行状态 |
    +------+--------+----------+---------+---------+-----+----------+
    | 1    | abc    | A        | 1.2.3.4 | default | 600 | 创建成功 |
    +------+--------+----------+---------+---------+-----+----------+
    
  5. 更新域名解析记录
    alidns update test.cn -n abc -v 1.2.3.4 -nn foo -nv 22.2.111.1
    +------+--------+----------+------------+---------+-----+--------------------+----------+
    | 序号 | 子域名 | 记录类型 | 记录值     | 线路    | TTL | 记录ID             | 执行状态 |
    +------+--------+----------+------------+---------+-----+--------------------+----------+
    | 1    | foo    | A        | 22.2.111.1 | default | 600 | 913431792258240512 | 修改成功 |
    +------+--------+----------+------------+---------+-----+--------------------+----------+
    
  6. 删除域名解析记录
    alidns delete test.cn -n foo
    +------+--------+----------+------------+---------+-----+----------+
    | 序号 | 子域名 | 记录类型 | 记录值     | 线路    | TTL | 执行状态 |
    +------+--------+----------+------------+---------+-----+----------+
    | 1    | foo    | A        | 22.2.111.1 | default | 600 | 删除成功 |
    +------+--------+----------+------------+---------+-----+----------+
    

    注意:

    1. 删除记录时, 子域名为必须参数
    2. 删除记录时,只指定子域名,删除与子域名匹配的所有记录。
    3. 如需删除特定的记录,请指定 记录ID (--record-id)

开发测试

  1. 创建虚拟环境
  2. 安装 pip install -e .

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

dnscli-0.0.2.tar.gz (13.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dnscli-0.0.2-py3-none-any.whl (15.4 kB view details)

Uploaded Python 3

File details

Details for the file dnscli-0.0.2.tar.gz.

File metadata

  • Download URL: dnscli-0.0.2.tar.gz
  • Upload date:
  • Size: 13.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for dnscli-0.0.2.tar.gz
Algorithm Hash digest
SHA256 3cf2b8f0ac169b577ad0ec6ae78726d25e2196837fd070bd5afa02c95dbb157d
MD5 8875590686ee01cfe7d8038bc1b242d9
BLAKE2b-256 c0ba6d3a70990957ac27db31ebb27e0c18d03e3b00bca616b30e952c25b01e8f

See more details on using hashes here.

File details

Details for the file dnscli-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: dnscli-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 15.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for dnscli-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 041fa2803e567083f3b1b8effed01390c042895791ae0844d01975cff616538f
MD5 878c4d8fbb854ad7640791dd56b357ef
BLAKE2b-256 0a5aab5d297f7b9fae03af7b231121a2168f37b736e309cabd62f57ec429772b

See more details on using hashes here.

Supported by

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