lanbugs / hdns_cli Goto Github PK
View Code? Open in Web Editor NEWHetzner DNS CLI Tool
License: GNU General Public License v3.0
Hetzner DNS CLI Tool
License: GNU General Public License v3.0
Hi,
the Hetzner DNS Api returns only the first 100 entries.
I'm managing > 500 DNS Entries at the moment.
i did some changes to support up to 1000 entries.
Maybe you can adopt the idea
--
def show_zones(self):
""" Show all zones eg. hdns show_zones """
pageNum = 1
result_header = ['ID', 'Zone', 'Secondary?', 'NS']
results = []
while pageNum <= 10 :
try:
response = requests.get(
url=f"https://{self.SYSTEM}/api/v1/zones?page={pageNum}",
headers={"Auth-API-Token": self.API_TOKEN}
)
status_code = response.status_code
content = json.loads(response.content)
for zone in content['zones']:
results.append(
[
zone['id'],
zone['name'],
zone['is_secondary_dns'],
", ".join(zone['ns'])um = pageNum + 1
except requests.exceptions.RequestException as e:
logger.exception(e)
print(f"*** Zones @ {self.SYSTEM} " + "*"*80)
print(tabulate.tabulate(results, result_header))
--
and:
--
def _get_zone_id(self, zone_name):
""" PRIVATE: Get the zone id to work with names in records add, mod, remove """
try:
pageNum = 1
while pageNum <= 10 :
response = requests.get(
url=f"https://{self.SYSTEM}/api/v1/zones?page={pageNum}",
headers={"Auth-API-Token": self.API_TOKEN}
)
status_code = response.status_code
content = json.loads(response.content)
if status_code == 200:
for zone in content['zones']:
if zone_name == zone['name']:
return zone['id']
pageNum = pageNum + 1
return False
except requests.exceptions.RequestException as e:
logger.exception(e)
--
update_record resets the ttl of my A record to 0.
I found no way to edit the ttl after the update via hdns cli to my needs.
Is it a missing feature or am I overlooking a command I could use after the update to achieve editing the ttl?
Thank you in advance and for your great work!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.