Skip to main content

A simple library to handle Hetzner DNS API

Project description

hdns

License PyPI version

Overview

This library is intended for people that do not have an static IP from their ISP but want to keep updated their A records at Hetzner DNS service

Installation

pip install hdns requests json sys

Example usage to update all A records with the current IPv4 ip

from hdns import arecords, ipv4

zone_id = "XXXXXXX"
auth_api_token = "XXXXXX"

ip = ipv4.get_ipv4()
records = arecords.get_all(zone_id, auth_api_token)

different_ip_zone_ids = []

for record in records:
    if record["value"] != ip:
        record["value"] = ip
        different_ip_zone_ids.append(record)
if different_ip_zone_ids:
    insert_records = arecords.insert_records(auth_api_token, different_ip_zone_ids)
    print(insert_records)
else:
    print("No need for update, IPv4 is still the same!")

ipv4: uses https://api.ipify.org API to get your IPv4 public IP

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

hdns-0.6.tar.gz (2.3 kB view details)

Uploaded Source

Built Distribution

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

hdns-0.6-py3-none-any.whl (2.8 kB view details)

Uploaded Python 3

File details

Details for the file hdns-0.6.tar.gz.

File metadata

  • Download URL: hdns-0.6.tar.gz
  • Upload date:
  • Size: 2.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.12

File hashes

Hashes for hdns-0.6.tar.gz
Algorithm Hash digest
SHA256 0fc978cf5beb2f45df03eea80eed498c134da129c6a1f4f8def726b4fae78f5b
MD5 6feb7e08f28babe6c24d3689f20e0d72
BLAKE2b-256 1f8eccd1d60536863ec7fb794612e227d17658f6255ac21587f1cda7b9f10638

See more details on using hashes here.

File details

Details for the file hdns-0.6-py3-none-any.whl.

File metadata

  • Download URL: hdns-0.6-py3-none-any.whl
  • Upload date:
  • Size: 2.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.12

File hashes

Hashes for hdns-0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 2f74476da913b4c4320e958519706c1a5bbdb02ce3ec98643aaee0f9355e99e2
MD5 f63dbf4e9a9c256cfad8f8f79b82c546
BLAKE2b-256 17d5a8894aeef65306d3dfa83823cd86813cec0b794af218a194d17094cfff71

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