Skip to content

Examples

Welcome to the Oinker examples! This section provides practical, copy-paste-ready code for every Porkbun API operation.

Quick Navigation

Section What You'll Learn
DNS Records Create, list, update, and delete DNS records of all types
Domains Manage nameservers, URL forwarding, glue records, and check availability
DNSSEC Configure DNSSEC at the registry level
SSL Certificates Retrieve free SSL certificates for your domains
Pricing Query TLD pricing (no authentication required)
Dynamic DNS Build a complete dynamic DNS updater script

Before You Start

Installation

pip install oinker

Authentication

Set your Porkbun API credentials:

export PORKBUN_API_KEY="pk1_..."
export PORKBUN_SECRET_KEY="sk1_..."

Getting API Keys

  1. Log in to Porkbun
  2. Go to Account > API Access
  3. Create an API key pair
  4. Enable API access for each domain you want to manage

Async vs Sync

All examples show both async and sync versions. Use async for web applications and concurrent operations; use sync for scripts and CLI tools.

from oinker import AsyncPiglet

async with AsyncPiglet() as piglet:
    result = await piglet.ping()
from oinker import Piglet

with Piglet() as piglet:
    result = piglet.ping()

Example Structure

Each example page follows this pattern:

  1. Quick Start - The most common operation
  2. All Operations - Every API method with examples
  3. Real-World Patterns - Practical use cases combining multiple operations

Ready to dive in? Start with DNS Records - the most commonly used API.