Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hdns

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hdns

A simple library to handle Hetzner DNS API

  • 0.7
  • PyPI
  • Socket score

Maintainers
1

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 arecords.get_all(): accepts two values the zone_id and the auth_api_token to be able to function ipv4.get_ipv4(): can be called without any value to return your public IP arecords.insert_records(): accepts two values auth_api_token and an json array object with records that need to be modified

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc