teamhack-dns

raw JSON →
0.0.1398 verified Sat May 09 auth: no python

Hack the Box Team Support Services library for managing DNS records and team infrastructure. Currently at version 0.0.1398 with rapid, frequent releases; no stable release schedule yet.

pip install teamhack-dns
error ModuleNotFoundError: No module named 'teamhackdns'
cause Trying to import with hyphens or without underscore.
fix
Install with pip install teamhack-dns and import as from teamhack_dns import TeamHackDNS.
error TypeError: __init__() got an unexpected keyword argument 'key'
cause Using the old parameter name `key` for API key.
fix
Use api_key instead: TeamHackDNS(api_key='...').
error AttributeError: 'TeamHackDNS' object has no attribute 'add_record'
cause Using deprecated method name in newer version.
fix
Use create_record() instead of add_record().
gotcha Package name uses hyphens (teamhack-dns) but the Python import uses underscores (teamhack_dns). A common mistake is to import with hyphens.
fix Use `from teamhack_dns import ...` (underscores).
breaking The API key parameter name changed from 'key' to 'api_key' in v0.0.1300. Old code passing `key=` will fail with TypeError.
fix Use `api_key=your_key` instead of `key=your_key`.
deprecated The `add_record()` method is deprecated in favor of `create_record()`. It still works but will be removed in a future release.
fix Replace `client.add_record(...)` with `client.create_record(...)`.

Initialize the client with your API key and list DNS records.

from teamhack_dns import TeamHackDNS
import os

client = TeamHackDNS(
    api_key=os.environ.get('TEAMHACK_API_KEY', '')
)

# List all DNS records
records = client.list_records()
print(records)