Skip to main content

FastSSL - SSL证书管理SDK,支持申请、验证和获取SSL证书

Project description

FastSSL

FastSSL 是一个用于管理SSL证书的Python SDK,支持申请、验证和获取SSL证书。

签发密钥获取渠道:ssl.aa1.cn/user/

安装

pip install fastssl

快速开始

from fastssl import FastSSLClient

# 初始化客户端
client = FastSSLClient(api_key="your_api_key")

# 申请SSL证书
result = client.create_certificate(
    certificate_domain="example.com",
    channel_type="zerossl",  # 可选: zerossl, letsencrypt, google
    validation_method="DNS"  # API统一使用DNS,但实际记录类型不同:
                             # zerossl -> CNAME记录, letsencrypt/google -> TXT记录
)

# 验证域名
verify_result = client.verify_domain(domain="example.com")

# 获取证书信息
cert_info = client.get_certificate_info(domain="example.com")

# 一键申请并验证(便捷方法)
full_result = client.create_and_verify(
    certificate_domain="example.com",
    channel_type="zerossl"
)

API 文档

FastSSLClient

__init__(api_key: str)

初始化FastSSL客户端。

参数:

  • api_key: API密钥

create_certificate(certificate_domain: str, channel_type: str = "zerossl", validation_method: str = "DNS")

申请SSL证书。

参数:

  • certificate_domain: 需要验证的域名
  • channel_type: 证书品牌,可选值: zerossl, letsencrypt, google
  • validation_method: 验证方式,默认为 DNS(API统一使用DNS,但实际DNS记录类型不同:
    • zerossl 使用 CNAME 记录
    • letsencrypt/google 使用 TXT 记录)

返回: 包含证书申请结果的字典

verify_domain(domain: str, max_retries: int = 10, retry_interval: int = 5)

验证域名并等待证书签发完成。如果验证成功但download_url为空,会自动重试。

参数:

  • domain: 要验证的域名
  • max_retries: 最大重试次数(当download_url为空时)
  • retry_interval: 重试间隔(秒)

返回: 包含验证结果的字典

get_certificate_info(domain: str)

获取证书信息,自动处理证书内容中的换行符。

参数:

  • domain: 域名

返回: 包含证书信息的字典

create_and_verify(certificate_domain: str, channel_type: str = "zerossl", validation_method: str = "DNS", max_retries: int = 10, retry_interval: int = 5)

一键申请并验证证书的便捷方法。

参数:

  • certificate_domain: 需要验证的域名
  • channel_type: 证书品牌
  • validation_method: 验证方式,默认为 DNS
  • max_retries: 验证最大重试次数
  • retry_interval: 重试间隔(秒)

返回: 包含完整流程结果的字典

示例

基本使用

from fastssl import FastSSLClient

client = FastSSLClient(api_key="your_api_key")

# 申请证书
create_result = client.create_certificate(
    certificate_domain="example.com",
    channel_type="zerossl"
)

if create_result.get("success"):
    print("证书申请成功!")
    print(f"验证信息: {create_result.get('data', {}).get('verify_info')}")
    
    # 验证域名
    verify_result = client.verify_domain("example.com")
    
    if verify_result.get("success"):
        print("证书验证成功!")
        print(f"下载地址: {verify_result.get('data', {}).get('download_url')}")
        
        # 获取证书信息
        cert_info = client.get_certificate_info("example.com")
        if cert_info.get("success"):
            print("证书内容:")
            print(cert_info.get("data", {}).get("crt_pem"))

一键申请并验证

from fastssl import FastSSLClient

client = FastSSLClient(api_key="your_api_key")

result = client.create_and_verify(
    certificate_domain="example.com",
    channel_type="zerossl",
    max_retries=15,  # 最多重试15次
    retry_interval=10  # 每次间隔10秒
)

if result.get("success"):
    verify_data = result.get("verify_result", {}).get("data", {})
    print(f"证书编号: {verify_data.get('certificate_no')}")
    print(f"下载地址: {verify_data.get('download_url')}")

许可证

MIT License

支持

如有问题或建议,请提交Issue。

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

fastssl-0.1.1.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

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

fastssl-0.1.1-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file fastssl-0.1.1.tar.gz.

File metadata

  • Download URL: fastssl-0.1.1.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for fastssl-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d80e5adfecf9bc5974b09846887cb3b3770e850a5cb0d57877a4f308c289c159
MD5 52c0bab5e4ec25d7c09cb13ebc04f1f6
BLAKE2b-256 ed9a101ae03e13eb366e6fd51a5911a9b98594dc529de121901633295e65c673

See more details on using hashes here.

File details

Details for the file fastssl-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: fastssl-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for fastssl-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 380a516a2b486494b7c7c48267fddd9f0b6a697daf0bc59acca40e58e397791a
MD5 a21d93c8c0bedd2692dfd42bd5527377
BLAKE2b-256 d6baf9972e344f340b07e1deb51863f990029d8b9a5d9738ef516f4dfb679fe4

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