🔒 SSL¶
SSL certificate retrieval operations.
🚀 Quick Example¶
from oinker import AsyncPiglet
async with AsyncPiglet() as piglet:
bundle = await piglet.ssl.retrieve("example.com")
# Save the certificate chain
with open("cert.pem", "w") as f:
f.write(bundle.certificate_chain)
# Save the private key
with open("key.pem", "w") as f:
f.write(bundle.private_key)
# Public key is also available
print(bundle.public_key)
Free SSL Certificates
Porkbun provides free SSL certificates for domains using their nameservers. The certificates are issued by Let's Encrypt and auto-renew.
Operations¶
AsyncSSLAPI¶
oinker.ssl.AsyncSSLAPI
¶
Async SSL operations for the Porkbun API.
Accessed via piglet.ssl.* methods.
Initialize SSL API.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
http
|
HttpClient
|
The HTTP client for making requests. |
required |
Source code in src/oinker/ssl/_api.py
retrieve
async
¶
Retrieve the SSL certificate bundle for a domain.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
domain
|
str
|
The domain name (e.g., "example.com"). |
required |
Returns:
| Type | Description |
|---|---|
SSLBundle
|
SSLBundle containing certificate chain, private key, and public key. |
Raises:
| Type | Description |
|---|---|
AuthenticationError
|
If credentials are invalid. |
NotFoundError
|
If domain is not found or has no SSL certificate. |
APIError
|
If the request fails. |
Source code in src/oinker/ssl/_api.py
SyncSSLAPI¶
oinker.ssl.SyncSSLAPI
¶
Bases: SyncAPIBase['AsyncSSLAPI']
Synchronous SSL operations for the Porkbun API.
Accessed via piglet.ssl.* methods.
Source code in src/oinker/_sync_base.py
Types¶
SSLBundle¶
oinker.SSLBundle
dataclass
¶
SSL certificate bundle for a domain.
Attributes:
| Name | Type | Description |
|---|---|---|
certificate_chain |
str
|
The complete certificate chain (PEM format). |
private_key |
str
|
The private key (PEM format). |
public_key |
str
|
The public key (PEM format). |
from_api_response
classmethod
¶
Create from API response data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
dict[str, Any]
|
The API response dictionary. |
required |
Returns:
| Type | Description |
|---|---|
SSLBundle
|
An SSLBundle instance. |