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"
)

# 验证域名
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

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

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: 验证方式
  • 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.0.tar.gz (4.1 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.0-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fastssl-0.1.0.tar.gz
  • Upload date:
  • Size: 4.1 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.0.tar.gz
Algorithm Hash digest
SHA256 c6ac558bec4b60037a0e81fec6b1bfdc5a628e6afbee471ea5a65c75f20a4391
MD5 58e749293d950a83fd8566e39d9c62c7
BLAKE2b-256 eebb6bf079c2fa48454e7e869b5f6c2d91485d6c0a4dd4c0ad1f7a442c08c770

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fastssl-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.7 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c01497717deca58a17b9423cdf18bc66e5608cce4a453a8f6aa083bf332283a2
MD5 cc6ebedfcdc82523ce49ec4f6611051c
BLAKE2b-256 973fb4176a5e0e87575f83a322ba06a085fe27b8d4ab480f400dbb76b8a9e183

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