-
Notifications
You must be signed in to change notification settings - Fork 29
Conversation
Modernizes the Python DDNS client: * Use argparse for CLI argument handling (better help text, validation and error messages) * Accept config file from stdin * Use modern Python naming conventions * Use ipaddress for validation * Default value for the base url of the API * Closes porkbundomains#2 * Closes porkbundomains#3
@rossporkbun @eddie-porkbun please review. I tried to keep the CLI as much as possible - at some point, in a later PR, I'd like to add braking changes if that is okay with you: Namely, a default config file location in |
If I try to use this with -i IPV6 adress, it set's the A record, I guess it should properly format the args when the ip is given. |
@benneti are you sure, because there is: https://github.com/con-f-use/porkbun-dynamic-dns-python/blob/patch-1/porkbun-ddns.py#L52 in the code. |
Thanks for the quick reply.
Yeah I saw this, too and was surprised that it nonetheless chose A.
I can double check later whats args contains if I use -i.
On 12 February 2022 11:02:58 CET, con-f-use ***@***.***> wrote:
***@***.*** are you use, because there is: https://github.com/con-f-use/porkbun-dynamic-dns-python/blob/patch-1/porkbun-ddns.py#L52 in the code.
--
Reply to this email directly or view it on GitHub:
#6 (comment)
You are receiving this because you were mentioned.
Message ID: ***@***.***>
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
|
ok sorry it works as intended now, I guess I mixed up the lines. def delete_record(args):
type_ = "A" if args.public_ip.version == 4 else "AAAA"
for i in get_records(args)["records"]:
if i["name"] == args.fqdn and i["type"] in [type_, "ALIAS", "CNAME"]:
print("Deleting existing {}-Record: {}".format(i["type"], i))
api(args, "/dns/delete/" + args.domain + "/" + i["id"]) would be better suited |
@benneti You just need to be in and then click on a staring line and drag to the last line your change is about. |
I did not, but I think I could also have done a review to achieve the same. |
@con-f-use sorry for the delay in this response. Thank you so much for doing all this work, and I bow to your Python knowledge, it bests mine. I'm guessing this can't be made Python 2 compliant, which is a necessary requirement for the program. If you can, I'd be glad to consider the pull request. Otherwise, if you want to release the client on your own, I will happily link to your repo in our official documentation. That way, you can maintain it yourself rather than relying on me to approve your pull requests, as I am admittedly slow to take action. |
I think it can be lightly tweaked to work with Python 2 AND 3. I'll see what I can do. That being said, a word of advice: Python 2 has been end of life for close to |
It does work with python2.7 as long as |
@rossporkbun any Update on this? This would be highly beneficial for all users with IPv6 dual-stack lite connection which getting more common. |
Given the low activity I'd be surprised to see a response in the near future, but just in case it happens to help you I figured I would mention that ddclient recently added porkbun support in ddclient/ddclient#437. Not sure if it's in an official ddclient release yet. |
Ross actually has left Porkbun some time ago for new adventures. Ultimately this was meant to be an example of how to use our API for DDNS, provided as is, rather than an officially supported client. Using ddclient is probably a better way to go and I'll be sure to test it out myself soon. |
@eddie-porkbun |
Modernizes the Python DDNS client:
__main__
for use as executable script