Python SDK for Realtime Register API
Project description
Realtime Register Python SDK
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
requestslibrarypython-dateutillibrary
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.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
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.0.tar.gz
(23.7 kB
view details)
File details
Details for the file realtimeregister-1.0.0.tar.gz.
File metadata
- Download URL: realtimeregister-1.0.0.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a746fbb0b0c4822f0071fc107708daff068be9cd78fa680adf4bcafa808d7b8a
|
|
| MD5 |
641ee174617be7d2f8bd3ccb4846e697
|
|
| BLAKE2b-256 |
1342afedde2573feffc957cac50cd3cecdc9e11f541dfe1d7c8aa15860ef45e6
|