Skip to main content

Python client for the Domainrobot JSON API (InterNetX/AutoDNS)

Project description

Python Domainrobot (InternetX/AutoDNS) Library

Documentation Status Coverage Status

Python client for the Domainrobot JSON API (InterNetX/AutoDNS).

Installation

pip install domainrobot

Quick start

from domainrobot import Domainrobot

with Domainrobot(username="user", password="pass", context=4) as client:
    # list all domains
    result = client.domain.list()
    for domain in result.data:
        print(domain.name, domain.expire, domain.registryStatus)

Listing all domains

client.domain.list() returns a response where each item in data is a Domain model with these attributes:

Attribute Type Description
name str The name of the domain.
idn str The unicode domain name
expire datetime The expire date of the domain.
payable datetime The payable date of the domain.
registryStatus str The registry status.
autoRenewStatus str The autorenew status.
dnssec bool Indicates whether DNSSEC is enabled for the domain or not.
privacy bool Enable privacy service for the domain.
trustee bool Enable trustee service for the domain.
domainsafe bool Enable domainsafe.
ownerc dict The owner contact.
adminc dict The administrative contact.
techc dict The technical contact reference.
nameServers list[dict] The nameservers.
comment str A custom field. Can only be updated via PUT /domain/{name}/_comment. Requires appropriate ACLs.
created datetime Date of creation.
updated datetime Date of the last update.
extra dict Any unknown/new API fields
result = client.domain.list(
    {"filters": [{"key": "name", "value": "*.com", "operator": "LIKE"}]},
    keys=["status", "expire"],
)
for domain in result.data:
    print(f"{domain.name}  expires={domain.expire}  status={domain.registryStatus}")

Domain operations

# register (async - returns Job)
job_result = client.domain.create({
    "name": "example.com",
    "ownerc": {"id": 1},
    "adminc": {"id": 1},
    "techc": {"id": 1},
})
print(job_result.data[0].status)  # "RUNNING"

# get info (returns Domain)
result = client.domain.info("example.com")
print(result.data[0].authinfo)

# transfer
client.domain.transfer({"name": "example.com", "authinfo": "secret"})

# cancelation
client.domain.cancelation_create("example.com", {"type": "DELETE", "execution": "EXPIRE"})

Contact

# create (returns Contact)
result = client.contact.create({
    "type": "PERSON",
    "fname": "John",
    "lname": "Doe",
    "email": "john@example.com",
    "country": "DE",
    "city": "Munich",
    "pcode": "80333",
    "address": ["Marienplatz 1"],
    "phone": "+49-89-12345",
})
print(result.data[0].id)  # contact ID

# update
client.contact.update(result.data[0].id, {"fname": "Jane"})

Certificate

# prepare order (returns CertificateData)
prep = client.certificate.prepare_order({"plain": "-----BEGIN CERTIFICATE REQUEST-----\n..."})

# order (async - returns Job)
client.certificate.create({
    "product": "BASIC_SSL",
    "csr": "-----BEGIN CERTIFICATE REQUEST-----\n...",
    "adminContact": {"id": 1},
    "technicalContact": {"id": 1},
})

# get info (returns Certificate)
result = client.certificate.info(456)
print(result.data[0].serialNumber)

Zone

# create (returns Zone)
client.zone.create({
    "origin": "example.com",
    "soa": {"email": "admin@example.com", "refresh": 43200, "retry": 7200, "expire": 1209600, "ttl": 86400},
    "main": {"address": "1.2.3.4"},
})

# stream update - add/remove records (returns Zone)
result = client.zone.stream("example.com", {
    "adds": [{"name": "www", "type": "A", "value": "1.2.3.4", "ttl": 3600}],
    "rems": [],
})
print(result.data[0].resourceRecords)

Error handling

from domainrobot import DomainrobotApiError, DomainrobotTransportError

try:
    client.domain.info("nonexistent.example")
except DomainrobotApiError as e:
    print(f"API error {e.status_code}: {e}")
    print(e.messages)
except DomainrobotTransportError as e:
    print(f"Connection error: {e}")

Custom headers

Every method accepts an optional headers parameter:

client.domain.info("example.com", headers={"X-Domainrobot-Demo": "true"})

Available services

Service Attribute Response model Key endpoints
Account client.account Account info, update
BackupMx client.backup_mx BackupMx create, info, delete, list
Certificate client.certificate Certificate / Job create, info, reissue, delete, renew, revoke, list
Contact client.contact Contact create, info, update, delete, list
Domain client.domain Domain / Job create, info, update, list, transfer, renew, restore
DomainStudio client.domain_studio DomainEnvelope search
Hello client.hello - ping
Job client.job ObjectJob info, list, cancel, confirm
MailProxy client.mail_proxy MailProxy create, info, update, delete, list
Poll client.poll PollMessage info, confirm
Redirect client.redirect Redirect create, info, update, delete, list
Session client.session User login, logout
SslContact client.ssl_contact SslContact create, info, update, delete, list
Subscription client.subscription Subscription create, update, delete, list
TransferOut client.transfer_out TransferOut list, answer
User client.user User create, info, update, delete, list
Zone client.zone Zone create, info, update, delete, list, stream, import_zone

Documentation

Full API reference: domainrobot-python.readthedocs.io

License

GPL-3.0-or-later

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

domainrobot-0.0.2.tar.gz (108.4 kB view details)

Uploaded Source

Built Distribution

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

domainrobot-0.0.2-py3-none-any.whl (40.6 kB view details)

Uploaded Python 3

File details

Details for the file domainrobot-0.0.2.tar.gz.

File metadata

  • Download URL: domainrobot-0.0.2.tar.gz
  • Upload date:
  • Size: 108.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for domainrobot-0.0.2.tar.gz
Algorithm Hash digest
SHA256 dde3d3fded591ee35e72deb07f5b507154e955288a74e1f7fe79f1745e08e131
MD5 3b78110e196b5ba1b4c64bc539756773
BLAKE2b-256 d7c6b509c75c7fe70a9732bf05e7d6ed49cb18e7198a8c7d0bb1f46d7aa61b48

See more details on using hashes here.

Provenance

The following attestation bundles were made for domainrobot-0.0.2.tar.gz:

Publisher: publish.yml on DigitalTolk/domainrobot-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file domainrobot-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: domainrobot-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 40.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for domainrobot-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 603bf69e9171496bcf0673093953266606a514cbe68fa1ea4322d5e75eaeee0c
MD5 d03730da97599aabecd3a98f41abd970
BLAKE2b-256 60c236d0472afcde67bafc6cd95d6010b0e0df19bb96e72a4cac7f3debaa11ad

See more details on using hashes here.

Provenance

The following attestation bundles were made for domainrobot-0.0.2-py3-none-any.whl:

Publisher: publish.yml on DigitalTolk/domainrobot-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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