Package: pynonamedomain
PyNonameDomainUnofficial NonameDomain.hu API module and CLI toolInstallationpipinstallpynonamedomain//Usepip3ifPython2isthedefaultonyoursystemnnd-cli$ nnd-cli 
Usage: nnd-cli [OPTIONS] COMMAND [ARGS]...

  Unofficial CLI tool for NonameDomain.hu

Options:
  --help  Show this message and exit.

Commands:
  create   Create new entry in the zone.
  login    Aquire API token.
  read     Read/find DNS entries in the zone.
  remove   Remove DNS entry from the zone.
  update   Update DNS entry in the zone.
  version  Version info.Autocompleteeval"$(_NND_CLI_COMPLETE=sourcennd-cli)"# for BASHeval"$(_NND_CLI_COMPLETE=source_zshnnd-cli)"# for ZSHBasic usageexportNND_DOMAIN="example.com"# optionalexportNND_USERNAME="api_user"# optionalexportNND_PASSWORD="api_pw"# optionalexportNND_TOKEN=$(nnd-clilogin-q)# optionalnnd-cliread|jq
nnd-clicreate-r'{"type":"A","host":"test","ip":"192.168.0.1","ttl":300}'nnd-cliread-r'{"type":"A"}'-ocsv
nnd-cliupdate--hashd67053c0cc0a544e074696a63723b296feeec564d-r'{"host":"test2"}'nnd-cliremove--hashd67053c0cc0a544e074696a63723b296feeec564dSee per command--helpfor more info.Using withcertbotexportNND_DOMAIN="example.com"# recommendedexportNND_USERNAME="api_user"# mandatoryexportNND_PASSWORD="api_pw"# mandatoryexportNND_TOKEN=$(nnd-clilogin-q)# mandatorycertbotcertonly--manual--preferred-challenges=dns--manual-auth-hook"nnd-cli create -c"--manual-cleanup-hook"nnd-cli remove -q"-dexample.com--manual-public-ip-logging-ok--agree-tos-m"your@email.address"Using withlegocp/usr/lib/python3.7/site-packages/pynonamedomain/lego-helper.sh.# edit ./lego-helper.sh with your credentialsexportEXEC_PATH=$(pwd)/lego-helper.sh
lego--dnsexec--domainsexample.com--email"your@email.address"--accept-tosrunUsing withTraefikSince Traefik useslegofor ACME certs, the same helper script can be used.cp/usr/lib/python3.7/site-packages/pynonamedomain/lego-helper.sh.# edit ./lego-helper.sh with your credentialsexportEXEC_PATH=$(pwd)/lego-helper.sh# Traefik will handle the restpynonamedomainUsageclass NonameDomain(domain, api_user=None, api_pw=None, token=None)Class to implement CRUD operations to the Noname Domain APILog into the API.Argsdomain: the domain to manageapi_user: API userapi_pw: password of API usertoken: API tokenRaisesValueError: if neither user+password or token providedExamplesnnd = pynonamedomain.NonameDomain("example.com", "username", "password")nnd = pynonamedomain.NonameDomain("example.org", token = "3e4n23y87tresnt32erstn48")def create(self, **data)Create new DNS entry.Note: TTL must be 300 or higherArgs**data: a dictionary with all the necessary data to create a new entryRaisesSubdomainAlreadyExists: if entry already existsrequests.HTTPError: if HTTP error occursrequests.SSLError: if SSL error occursReturns'ok' if entry created successfullyExamplesnnd.create(type = "A", host = "test", "ip" = "192.168.0.1", ttl = 600)nnd.create(type = "TXT", text = "something", host = "sample", ttl = 300)def read(self, cached=True, **search)Read the current entries in the zone.Argscached: returns cached list if True, otherwise query the API**search: filter the entries based on their attributesRaisesSubdomainNotFound: if entry not foundReturnsall subdomains ifsearchis omitted, otherwise the matching subdomainsExamplesnnd.read()nnd.read(cached = False)nnd.read(type = "A")def remove(self, record_hash)Remove entry from the zone.Argsrecord_hash: hash of the entry to be deletedRaisesrequests.HTTPError: if HTTP error occursrequests.SSLError: if SSL error occursReturns'ok' if entry removed successfullyExamplesnnd.remove("ab83e38eaquf86ye28e35E8c6")def update(self, record_hash, new_values)Update entry in the zone.Argsrecord hash: hash of the entry to be updatednew_values: dictionary of the new attributesRaisesValueError: ifnew_valuesis not a dictionaryReturns'ok' if entry updated successfullyExamplesnnd.update("ab83e38eaquf86ye28e35E8c6", text = "newtext", ttl = 300)nnd.update("ab83e38eaquf86ye28e35E8c6", type = "A", ip = "192.168.1.38")