Skip to main content

Python SDK for Realtime Register API

Project description

Realtime Register Python SDK

Latest Stable Version Total Downloads License Python Version

The Realtime Register Python SDK provides a convenient way to interact with the Realtime Register REST API from your Python applications.

Requirements

  • Python 3.7 or later
  • requests library
  • python-dateutil library

Installation

You can install the SDK via pip:

pip install realtimeregister

Usage

from realtimeregister import Client

# Initialize the client
client = Client(
    customer="your_customer_id",
    api_key="your_api_key",
    test_mode=True  # Set to False for production
)

# List domains
domains = client.domains.list()

# Get domain details
domain = client.domains.get("example.com")

# Register a new domain
new_domain = client.domains.register(
    domain="example.com",
    period=1,
    registrant={
        "name": "John Doe",
        "email": "john@example.com",
        "phone": "+1.1234567890",
        "address": {
            "street": "123 Main St",
            "city": "Anytown",
            "state": "ST",
            "zipcode": "12345",
            "country": "US"
        }
    }
)

Available API Endpoints

Domains

# List domains
client.domains.list()

# Get domain details
client.domains.get("example.com")

# Register domain
client.domains.register("example.com", registrant, period=1)

# Update domain
client.domains.update("example.com", nameservers=[...])

# Delete domain
client.domains.delete("example.com")

# Renew domain
client.domains.renew("example.com", period=1)

# Restore domain
client.domains.restore("example.com")

Contacts

# List contacts
client.contacts.list()

# Get contact details
client.contacts.get("contact123")

# Create contact
client.contacts.create("contact123", contact_data)

# Update contact
client.contacts.update("contact123", contact_data)

# Delete contact
client.contacts.delete("contact123")

DNS

# List DNS records
client.dns.list_records("example.com")

# Get DNS record
client.dns.get_record("example.com", "www", "A")

# Create DNS record
client.dns.create_record("example.com", "www", "A", ttl=3600, content={"ip": "1.2.3.4"})

# Update DNS record
client.dns.update_record("example.com", "www", "A", ttl=7200)

# Delete DNS record
client.dns.delete_record("example.com", "www", "A")

SSL Certificates

# List certificates
client.certificates.list()

# Get certificate details
client.certificates.get("cert123")

# Order certificate
client.certificates.order("example.com", "DV", "dns")

# Reissue certificate
client.certificates.reissue("cert123")

Billing

# List invoices
client.billing.list_invoices()

# Get invoice details
client.billing.get_invoice("inv123")

# Download invoice
client.billing.download_invoice("inv123")

# List transactions
client.billing.list_transactions()

Templates

# List templates
client.templates.list()

# Get template details
client.templates.get("welcome-email")

# Create template
client.templates.create("welcome-email", "email", "Welcome {{name}}!")

# Update template
client.templates.update("welcome-email", content="Updated welcome {{name}}!")

# Preview template
client.templates.preview("welcome-email", {"name": "John"})

Notifications

# List notifications
client.notifications.list()

# Get notification details
client.notifications.get("notif123")

# Create notification
client.notifications.create("webhook", "https://example.com/webhook", ["domain.expire"])

# Update notification
client.notifications.update("notif123", enabled=False)

# Test notification
client.notifications.test("notif123")

Abuse

# List abuse reports
client.abuse.list()

# Get abuse report details
client.abuse.get("abuse123")

# Create abuse report
client.abuse.create("example.com", "John Doe", "john@example.com", "Spam content")

# Update abuse report
client.abuse.update("abuse123", status="resolved")

Processes

# List processes
client.processes.list()

# Get process details
client.processes.get("proc123")

Statistics

# Get domain statistics
client.statistics.get_domain_statistics()

# Get billing statistics
client.statistics.get_billing_statistics()

# Get customer statistics
client.statistics.get_customer_statistics()

TLDs

# List TLDs
client.tlds.list()

# Get TLD details
client.tlds.get("com")

Reseller

# Get balance
client.reseller.get_balance()

# List transactions
client.reseller.list_transactions()

# Get transaction details
client.reseller.get_transaction("trans123")

Transfers

# List transfers
client.transfers.list()

# Get transfer details
client.transfers.get("example.com")

# Request transfer
client.transfers.request("example.com", "auth-code")

# Approve transfer
client.transfers.approve("example.com")

# Reject transfer
client.transfers.reject("example.com", "Invalid auth code")

Error Handling

The SDK provides detailed error handling through specific exception classes:

from realtimeregister.exceptions import (
    RealtimeRegisterException,
    ValidationException,
    AuthenticationException,
    NotFoundException
)

try:
    domain = client.domains.get("nonexistent.com")
except NotFoundException:
    print("Domain not found")
except AuthenticationException:
    print("Invalid credentials")
except ValidationException as e:
    print(f"Validation error: {str(e)}")
except RealtimeRegisterException as e:
    print(f"API error: {str(e)}")

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

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

realtimeregister-1.0.1.tar.gz (23.7 kB view details)

Uploaded Source

Built Distribution

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

realtimeregister-1.0.1-py3-none-any.whl (37.7 kB view details)

Uploaded Python 3

File details

Details for the file realtimeregister-1.0.1.tar.gz.

File metadata

  • Download URL: realtimeregister-1.0.1.tar.gz
  • Upload date:
  • Size: 23.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for realtimeregister-1.0.1.tar.gz
Algorithm Hash digest
SHA256 ff75478877e9e914b89641ae2b35254dfed6d475de7ee0212ba03956dd424f79
MD5 06b063c6088a8375f9409dfb65bec033
BLAKE2b-256 73fb4535091b12c5a400b9c7932d5a1dce930e5d18499f2afaac4da2e389a533

See more details on using hashes here.

File details

Details for the file realtimeregister-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for realtimeregister-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5b679182e0585a89576a323f0b44a70f50fafafa5b8c27ab85d89898882e1680
MD5 c76c9977d6c4564a4fb0bee9925dc09a
BLAKE2b-256 de5531fb007ad15a99365a3433caba8e692a3cf73239486f13bc168e22c57d2e

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