Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation, ACTUAL documentation of how to use the library #35

Open
samip5 opened this issue Feb 7, 2020 · 2 comments
Open

Documentation, ACTUAL documentation of how to use the library #35

samip5 opened this issue Feb 7, 2020 · 2 comments

Comments

@samip5
Copy link

samip5 commented Feb 7, 2020

How does one actually use this library?

I got my RDNS kinda working, but the library does not output anything which can be used to determine if it was successful?

@samip5 samip5 changed the title Documentation, ACTUAL documentation of library Documentation, ACTUAL documentation of how to use the library Feb 7, 2020
@aszlig
Copy link
Owner

aszlig commented Mar 5, 2020

First of all, I completely agree that this library needs better documentation and also better packaging.

I got my RDNS kinda working, but the library does not output anything which can be used to determine if it was successful?

You can look at the hetznerctl tool for example usage:

hetzner/hetznerctl

Lines 211 to 229 in e3e20a8

def execute(self, robot, parser, args):
if args.ip is None:
for rdns in robot.rdns:
self.putline("{0} -> {1}".format(rdns.ip, rdns.ptr))
elif args.delptr:
robot.rdns.get(args.ip).remove()
elif args.setptr:
if args.ip is None or args.value is None:
parser.error("Need exactly two arguments: IP address and new"
" reverse FQDN.")
else:
rdns = robot.rdns.get(args.ip)
rdns.set(args.value)
else:
rdns = robot.rdns.get(args.ip)
if rdns.ptr is None:
self.putline("No reverse record set for {0}.".format(rdns.ip))
else:
self.putline("{0} -> {1}".format(rdns.ip, rdns.ptr))

In terms of determining whether it was successfully set, first of all you get an exception if the POST on /rdns/N has failed. So in theory this should be enough. However if you want to be absolutely sure, you could call update_info() on the ReverseDNS object and check whether the value is the correct one.

@hth2
Copy link

hth2 commented Mar 20, 2023

I was in hurry to look for a way to get some info from Hetzner using command-line. I don't want PHP so I tried this library. Sadly the documentation is really lacking. I put my notes here, hope that it could save some time and frustration for people in similar situation.

# install:
pip3 install hetzner

# create a minimal config file:
cat <<EOT > ~/.hetznerrc
[login]
username = abc
password = def
EOT

# list all my servers:
hetznerctl  list

# show details of one server:
hetznerctl  show 1.2.3.4 # 1.2.3.4 = IP of the server from previous command

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants