Giter Club home page Giter Club logo

porkbun-ddns's Introduction

I'm Nils, a dedicated mechanical engineer with a keen focus on renewable energy systems. Additionally, I've delved into the realm of software development through self-guided learning, augmenting my engineering expertise. My professional journey has seen me traverse roles ranging from Data Scienec and Data Engineer to DevOps Engineer, alongside handling Linux system operations with expertise in Debian.

At present, I am deeply engaged in a significant project: leading the development of a cloud-based Data Science Platform at GP-Joule. This endeavor not only reflects my profound dedication to renewable energy but also underscores my proficiency in software engineering. It represents a fusion of my commitment to innovation and my vision for harnessing technology to foster sustainable solutions.

GitHub stats:

Anurag's github stats

porkbun-ddns's People

Contributors

cdchris12 avatar dependabot[bot] avatar dimo414 avatar lunareclipse363 avatar mietzen avatar realbadidas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

porkbun-ddns's Issues

Config file formatting?

There is no example of how the config file should be formatted, so not sure if that is causing my issue. I am running:

SERVER123:~/.local/bin$ ./porkbun-ddns .config domain.com sub.domain.com -v

...and am getting:

This shouldn't have happened!
Error: Expecting value: line 1 column 1 (char 0)
Traceback (most recent call last):
  File "/home/user/.local/lib/python3.8/site-packages/porkbun_ddns/cli.py", line 79, in main
    porkbun_ddns = PorkbunDDNS(config=config, domain=args.domain,
  File "/home/user/.local/lib/python3.8/site-packages/porkbun_ddns/porkbun_ddns.py", line 36, in __init__
    self._load_config(config)
  File "/home/user/.local/lib/python3.8/site-packages/porkbun_ddns/porkbun_ddns.py", line 58, in _load_config
    self.config = json.load(fid)
  File "/usr/lib/python3.8/json/__init__.py", line 293, in load
    return loads(fp.read(),
  File "/usr/lib/python3.8/json/__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.8/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

.config file is as follows:

PORKBUN_APIKEY = pk1_123456
PORKBUN_SECRETAPIKEY = sk1_1234567

Assume this should update the IP of the A record sub.domain.com ?
Many thanks!

Error when DNS Record already exists

I am using the docker container.

  • When I specify a custom sleep value, i will get the error TypeError: 'str' object cannot be interpreted as an integer

  • I have some trouble when the DNS Record already exists before the first startup. The request to create the record returns a 400 Bad Request Status. I assume this is because it is not recognized, that the record exists already and therefore the previous record is not deleted. Maybe there is some logic error when other DNS records are present?
    I have a record for local.mydomain.com that I want to keep static and the DNS Client should update the IP for the root domain mydomain.com!

  • Maybe set PYTHONUNBUFFERED=1 as environment variable for the docker container. Otherwise logfiles might get delayed and lost.

Just a few things noticed, but thank you for the devlopment of this client! Maybe I can look into this later by myself.

porkbun_ddns.porkbun_ddns.PorkbunDDNS_Error: Invalid API Keys!

Hi.

It's been a year and a half since I've tried to manage automatically my porkbun domain.

First of all I'm gonna explain hoy my net is working, so you would understand much better.

I have a NAS with Nginx Proxy Manager deployed. I use Duckdns as a free ddns provider (because it was the first one I used and because it works smoothly when my IP changes and the porkbun addresses stop working (I use the duckdns managed by linuxserver).

Here comes the thing. I've tried your docker compose:

version: "3"
services:
  porkbun-ddns:
    image: "mietzen/porkbun-ddns:latest"
    container_name: porkbun-ddns
    environment:
      DOMAIN: "domain.com"
      SUBDOMAINS: "xxx,xx,x,y,yyy,yy,z"
      SECRETAPIKEY: "sk1_alphanumeric"
      APIKEY: "pk1_alphanumeric"
      # PUBLIC_IPS: "1.2.3.4,2001:043e::1" # Set if you got static IP's
      FRITZBOX: "192.168.1.1" 
      # SLEEP: "300" # Seconds to sleep between DynDNS runs
      # IPV4_ONLY: "FALSE" # Only set IPv4 address
      # IPV6_ONLY: "FALSE" # Only set IPv6 address
      # DEBUG: "FALSE" # DEBUG LOGGING
    restart: always

The thing is.. Fritzbox? Never heard of it and I checked, a Router? I'm from Spain, we don't have such thing here. I don't get why don't you just set it as "router" or something like that. I've set my router address in case it works, who knows. But now. I'm checking the log from the container and it says:

Traceback (most recent call last):

  File "/usr/local/lib/python3.12/site-packages/porkbun_ddns-0.4.1-py3.12.egg/porkbun_ddns/porkbun_ddns.py", line 107, in _api

  File "/usr/local/lib/python3.12/urllib/request.py", line 215, in urlopen

    return opener.open(url, data, timeout)

           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.12/urllib/request.py", line 521, in open

    response = meth(req, response)

               ^^^^^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.12/urllib/request.py", line 630, in http_response

    response = self.parent.error(

               ^^^^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.12/urllib/request.py", line 559, in error

    return self._call_chain(*args)

           ^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.12/urllib/request.py", line 492, in _call_chain

    result = func(*args)

             ^^^^^^^^^^^

  File "/usr/local/lib/python3.12/urllib/request.py", line 639, in http_error_default

    raise HTTPError(req.full_url, code, msg, hdrs, fp)

urllib.error.HTTPError: HTTP Error 400: 

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

  File "/entrypoint.py", line 51, in <module>

    porkbun_ddns.update_records()

  File "/usr/local/lib/python3.12/site-packages/porkbun_ddns-0.4.1-py3.12.egg/porkbun_ddns/porkbun_ddns.py", line 132, in update_records

  File "/usr/local/lib/python3.12/site-packages/porkbun_ddns-0.4.1-py3.12.egg/porkbun_ddns/porkbun_ddns.py", line 119, in get_records

  File "/usr/local/lib/python3.12/site-packages/porkbun_ddns-0.4.1-py3.12.egg/porkbun_ddns/porkbun_ddns.py", line 110, in _api

porkbun_ddns.porkbun_ddns.PorkbunDDNS_Error: Invalid API Keys!

Could you help me to let know Porkbun when my IP changes so my domains keep working? Right now they are set manually.

Thank you.

domain and subdomain

hello I'm wondering if you can update the root domain and sub domain records at the same time?
Now as far as I know I type porkbun-ddns configfile domain.com and porkbun-ddns configfile domain.com '*'
to update the records for my root domain and then the wildcard one. Or am I doing something wrong?

[Docker Version, IPv6] Failed to obtain IP Addresses!

Hello @mietzen, thank you for your awesome project!

I am hosting a home server with IPv6 and encountered troubles with the docker version of this project.

Running sudo docker-compose up with the following docker-compose.yml on my Raspberry Pi

version: "3"
services:
  porkbun-ddns:
    image: "mietzen/porkbun-ddns:latest"
    container_name: porkbun-ddns
    environment:
      DOMAIN: "..." 
      SECRETAPIKEY: "..." 
      APIKEY: "..."
      FRITZBOX: "192.168.178.1" 
      SLEEP: "300" 
      IPV4: "FALSE"
      IPV6: "TRUE"
    restart: unless-stopped

I get the following error:

me@raspberrypi:~/porkbun $ sudo docker-compose up
Recreating porkbun-ddns ... done
Attaching to porkbun-ddns
porkbun-ddns    | Traceback (most recent call last):
porkbun-ddns    |   File "/entrypoint.py", line 65, in <module>
porkbun-ddns    | 2024-01-16 18:33:27,785 WARNING  Can't reach IPv6 Address! Check IPv6 connectivity!
porkbun-ddns    |     porkbun_ddns.update_records()
porkbun-ddns    |   File "/usr/local/lib/python3.12/site-packages/porkbun_ddns-0.5.0-py3.12.egg/porkbun_ddns/porkbun_ddns.py", line 142, in update_records
porkbun-ddns    |   File "/usr/local/lib/python3.12/site-packages/porkbun_ddns-0.5.0-py3.12.egg/porkbun_ddns/porkbun_ddns.py", line 102, in get_public_ips
porkbun-ddns    | porkbun_ddns.porkbun_ddns.PorkbunDDNS_Error: Failed to obtain IP Addresses!

I have verified that running the programm with IPv4 works (but is useless for me due to DS-Lite)

      IPV4: "FALSE"
      IPV6: "TRUE"

Do you have an Idea on how to fix the problem?

How to update both the domain and subdomain through docker compose?

Hello! As mentioned here #19 , multiple concurrent updates seem implemented.

However, after setting up docker compose with the environment variables as so:
"DOMAIN=my.domain",
"SUBDOMAINS=*",

only the A record of *.my.domain is getting updated , while my.domain is not. I am not very tech savvy, so there's probably something I am missing here.

HTTP Error 405: Not Allowed

Running the program two days ago worked fine, however today I get:
~$ porkbun-ddns "./config.json" MYDOMAIN

This shouldn't have happened!
Error: HTTP Error 405: Not Allowed
Traceback (most recent call last):
  File ".../.local/share/pipx/venvs/porkbun-ddns/lib/python3.9/site-packages/porkbun_ddns/cli.py", line 87, in main
    porkbun_ddns.update_records()
  File ".../.local/share/pipx/venvs/porkbun-ddns/lib/python3.9/site-packages/porkbun_ddns/porkbun_ddns.py", line 139, in update_records
    self.records = self.get_records()
  File ".../.local/share/pipx/venvs/porkbun-ddns/lib/python3.9/site-packages/porkbun_ddns/porkbun_ddns.py", line 126, in get_records
    records = self._api("/dns/retrieve/" + self.domain)
  File ".../.local/share/pipx/venvs/porkbun-ddns/lib/python3.9/site-packages/porkbun_ddns/porkbun_ddns.py", line 119, in _api
    raise err
  File ".../.local/share/pipx/venvs/porkbun-ddns/lib/python3.9/site-packages/porkbun_ddns/porkbun_ddns.py", line 114, in _api
    response = urllib.request.urlopen(req).read()
  File "/usr/lib/python3.9/urllib/request.py", line 214, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python3.9/urllib/request.py", line 523, in open
    response = meth(req, response)
  File "/usr/lib/python3.9/urllib/request.py", line 632, in http_response
    response = self.parent.error(
  File "/usr/lib/python3.9/urllib/request.py", line 561, in error
    return self._call_chain(*args)
  File "/usr/lib/python3.9/urllib/request.py", line 494, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.9/urllib/request.py", line 641, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 405: Not Allowed

On Debian 11

[Errno 99] Cannot assign requested address

Trying to migrate from a working setup of https://github.com/porkbundomains/porkbun-dynamic-dns-python and am seeing the container stuck in a constant restarting loop.

Current docker compose is

services:
  porkbun-ddns:
    image: "mietzen/porkbun-ddns:latest"
    container_name: porkbun-ddns
    environment:
      DOMAIN: "<redacted>.com" # Your Porkbun domain
      SUBDOMAINS: "adguard,jellyfin,deemix" # Subdomains comma spreaded
      SECRETAPIKEY: "<redacted>" # Your Porkbun Secret-API-Key
      APIKEY: "<redacted>" # Your Porkbun API-Key
    restart: unless-stopped

Which results in the following looping restart error:

2023-11-29 21:46:12 Traceback (most recent call last):
2023-11-29 21:46:12   File "/entrypoint.py", line 51, in <module>
2023-11-29 21:46:12     porkbun_ddns.update_records()
2023-11-29 21:46:12   File "/usr/local/lib/python3.12/site-packages/porkbun_ddns-0.4.1-py3.12.egg/porkbun_ddns/porkbun_ddns.py", line 135, in update_records
2023-11-29 21:46:12   File "/usr/local/lib/python3.12/site-packages/porkbun_ddns-0.4.1-py3.12.egg/porkbun_ddns/porkbun_ddns.py", line 90, in get_public_ips
2023-11-29 21:46:12   File "/usr/local/lib/python3.12/urllib/request.py", line 215, in urlopen
2023-11-29 21:46:12     return opener.open(url, data, timeout)
2023-11-29 21:46:12            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023-11-29 21:46:12   File "/usr/local/lib/python3.12/urllib/request.py", line 515, in open
2023-11-29 21:46:12     response = self._open(req, data)
2023-11-29 21:46:12                ^^^^^^^^^^^^^^^^^^^^^
2023-11-29 21:46:12   File "/usr/local/lib/python3.12/urllib/request.py", line 532, in _open
2023-11-29 21:46:12     result = self._call_chain(self.handle_open, protocol, protocol +
2023-11-29 21:46:12              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023-11-29 21:46:12   File "/usr/local/lib/python3.12/urllib/request.py", line 492, in _call_chain
2023-11-29 21:46:12     result = func(*args)
2023-11-29 21:46:12              ^^^^^^^^^^^
2023-11-29 21:46:12   File "/usr/local/lib/python3.12/urllib/request.py", line 1392, in https_open
2023-11-29 21:46:12     return self.do_open(http.client.HTTPSConnection, req,
2023-11-29 21:46:12            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023-11-29 21:46:12   File "/usr/local/lib/python3.12/urllib/request.py", line 1347, in do_open
2023-11-29 21:46:12     raise URLError(err)
2023-11-29 21:46:12 urllib.error.URLError: <urlopen error [Errno 99] Cannot assign requested address>
2023-11-29 21:47:13 Traceback (most recent call last):
2023-11-29 21:47:13   File "/usr/local/lib/python3.12/urllib/request.py", line 1344, in do_open
2023-11-29 21:47:13     h.request(req.get_method(), req.selector, req.data, headers,
2023-11-29 21:47:13   File "/usr/local/lib/python3.12/http/client.py", line 1319, in request
2023-11-29 21:47:13     self._send_request(method, url, body, headers, encode_chunked)
2023-11-29 21:47:13   File "/usr/local/lib/python3.12/http/client.py", line 1365, in _send_request
2023-11-29 21:47:13     self.endheaders(body, encode_chunked=encode_chunked)
2023-11-29 21:47:13   File "/usr/local/lib/python3.12/http/client.py", line 1314, in endheaders
2023-11-29 21:47:13     self._send_output(message_body, encode_chunked=encode_chunked)
2023-11-29 21:47:13   File "/usr/local/lib/python3.12/http/client.py", line 1074, in _send_output
2023-11-29 21:47:13     self.send(msg)
2023-11-29 21:47:13   File "/usr/local/lib/python3.12/http/client.py", line 1018, in send
2023-11-29 21:47:13     self.connect()
2023-11-29 21:47:13   File "/usr/local/lib/python3.12/http/client.py", line 1453, in connect
2023-11-29 21:47:13     super().connect()
2023-11-29 21:47:13   File "/usr/local/lib/python3.12/http/client.py", line 984, in connect
2023-11-29 21:47:13     self.sock = self._create_connection(
2023-11-29 21:47:13                 ^^^^^^^^^^^^^^^^^^^^^^^^
2023-11-29 21:47:13   File "/usr/local/lib/python3.12/socket.py", line 852, in create_connection
2023-11-29 21:47:13     raise exceptions[0]
2023-11-29 21:47:13   File "/usr/local/lib/python3.12/socket.py", line 837, in create_connection
2023-11-29 21:47:13     sock.connect(sa)
2023-11-29 21:47:13 OSError: [Errno 99] Cannot assign requested address
2023-11-29 21:47:13 
2023-11-29 21:47:13 During handling of the above exception, another exception occurred:

HTTP Error 400, when A Record exist and AAAA + A should be created

Code snippet to reproduce the failure:

import json
import logging
import sys
from porkbun_ddns import PorkbunDDNS

logger = logging.getLogger('porkbun_ddns')
logger.setLevel(logging.DEBUG)
handler = logging.StreamHandler(sys.stdout)
handler.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(message)s')
handler.setFormatter(formatter)
logger.addHandler(handler)

domain = 'my-domain.net'

with open('./config.json', 'r') as fid:
    config = json.load(fid)

porkbun_ddns = PorkbunDDNS(config, domain, ipv6=False)
porkbun_ddns.update_records()

porkbun_ddns = PorkbunDDNS(config, domain)
porkbun_ddns.update_records()

Output:

Creating A-Record for my-domain.net with content: 1.2.3.4, Status: SUCCESS
A-Record of my-domain.net is up to date!
Creating AAAA-Record for my-domain.net with content: 0000:0000:0000:0000:0000:0000:0000:1234, Status: SUCCESS
Traceback (most recent call last):
  File "/Users/nils/Developer/porkbun-dynamic-dns-python/local_test.py", line 26, in <module>
    porkbun_ddns.update_records()
  File "/Users/nils/Developer/porkbun-dynamic-dns-python/porkbun_ddns/porkbun_ddns.py", line 144, in update_records
    self._create_records(ip, record_type)
  File "/Users/nils/Developer/porkbun-dynamic-dns-python/porkbun_ddns/porkbun_ddns.py", line 170, in _create_records
    status = self._api("/dns/create/" + self.domain, data)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/nils/Developer/porkbun-dynamic-dns-python/porkbun_ddns/porkbun_ddns.py", line 106, in _api
    response = urllib.request.urlopen(req).read()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/[email protected]/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/urllib/request.py", line 216, in urlopen
    return opener.open(url, data, timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/[email protected]/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/urllib/request.py", line 525, in open
    response = meth(req, response)
               ^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/[email protected]/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/urllib/request.py", line 634, in http_response
    response = self.parent.error(
               ^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/[email protected]/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/urllib/request.py", line 563, in error
    return self._call_chain(*args)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/[email protected]/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/urllib/request.py", line 496, in _call_chain
    result = func(*args)
             ^^^^^^^^^^^
  File "/opt/homebrew/Cellar/[email protected]/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/urllib/request.py", line 643, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 400: 

IPv6 not working when using fritzbox_ip arg

When I use the fritzbox_ip arg, the ipv6 arg gets ignored. Only A records are getting updated. I am not sure if the problem is the script or my router though, I haven't looked at the code. Using the default config it updates both.

porkbun_ddns.porkbun_ddns.PorkbunDDNS_Error: Failed to obtain IP Addresses!

Hi there! I received this error just now while my router restarted and my ISP assigned me a new public IP address.

2024-04-21T17:18:41.489161082Z porkbun_ddns.porkbun_ddns.PorkbunDDNS_Error: Failed to obtain IP Addresses!
2024-04-21T17:19:43.563438284Z Traceback (most recent call last):
2024-04-21T17:19:43.563495743Z   File "/entrypoint.py", line 65, in <module>
2024-04-21T17:19:43.563439298Z 2024-04-21 17:19:43,563 WARNING  Can't reach IPv4 Address! Check IPv4 connectivity!
2024-04-21T17:19:43.563700288Z     porkbun_ddns.update_records()
2024-04-21T17:19:43.563728612Z   File "/usr/local/lib/python3.12/site-packages/porkbun_ddns-0.6.2-py3.12.egg/porkbun_ddns/porkbun_ddns.py", line 158, in update_records
2024-04-21T17:19:43.563887953Z   File "/usr/local/lib/python3.12/site-packages/porkbun_ddns-0.6.2-py3.12.egg/porkbun_ddns/porkbun_ddns.py", line 118, in get_public_ips

After digging through the Python script and checking the referenced lines per the logs, I stumbled across the URLs used to retrieve the latest public IPs:

urls = ['https://v4.ident.me',
'https://api.ipify.org',
'https://ipv4.icanhazip.com']

I copied and went to all three sites to see if any of them went down. Sure enough, the first URL pointing to v4.ident.me was down for some reason. I went to isitdownrightnow just to be sure if it was only me. Then, I copied that part of the script to test myself as to why the script failed, although there were two functioning sites (I tested the other two, and they worked) that could serve as backups to the first. Below is the script I used to test, essentially a direct copy from the source code with a little tweak to the error handling part. I am still learning Python, so I apologize if I did it wrongly:

import urllib.request

public_ips= []

urls = ['https://v4.ident.me',
'https://api.ipify.org',
'https://ipv4.icanhazip.com']
try:
    for url in urls:
        with urllib.request.urlopen(url) as response:
            if response.getcode() == 200:
                public_ips.append(response.read().decode('utf-8'))
                break
            print("Failed to retrieve IPv4 Address from %s! HTTP status code: %s", url, str(response.code()))
except Exception as e:
    print('Failed to retrieve IPv4 Address from %s! Error: %s' % (url, str(e)))

print(public_ips)

The output of the script was:

Failed to retrieve IPv4 Address from https://v4.ident.me! Error: <urlopen error [Errno 111] Connection refused>
[]

As you could see, the array was empty. This brought me to believe that the try-except block was misplaced and should've been within the for loop instead, like so:

for url in urls:
    try:
        with urllib.request.urlopen(url) as response:
            if response.getcode() == 200:
                public_ips.append(response.read().decode('utf-8'))
                break
            print("Failed to retrieve IPv4 Address from %s! HTTP status code: %s", url, str(response.code()))
    except Exception as e:
        print('Failed to retrieve IPv4 Address from %s! Error: %s' % (url, str(e)))

The refactored code above yielded the following output:

Failed to retrieve IPv4 Address from https://v4.ident.me! Error: <urlopen error [Errno 111] Connection refused>
['XXX.XXX.XXX'] <-- from the break statement once the URL response returns a 200 status

However, I wonder if I was looking at the right part of the code or if the experiment I conducted was even right. Do you have any insights into the issue I am facing? Any help is appreciated!

Errors on Python 3.9.2

Hi,

I really appreciate you putting in the time with this project - I've been with Porkbun for years so it's good to see someone maintaining access to their API.

I've just installed porkbun-ddns on a Raspberry Pi (Python 3.9.2) and added the install location to my PATH.

Whenever I execute any porkbun-ddns cli commands, including but not limited to porkbun-ddns -h for example - I get the following errors:

steveharman@raspberrypi:~ $ which porkbun-ddns
/home/steveharman/.local/bin/porkbun-ddns
steveharman@raspberrypi:~ $ porkbun-ddns -h
Traceback (most recent call last):
  File "/home/steveharman/.local/bin/porkbun-ddns", line 5, in <module>
    from porkbun_ddns.cli import main
  File "/home/steveharman/.local/lib/python3.9/site-packages/porkbun_ddns/__init__.py", line 1, in <module>
    from .porkbun_ddns import *
  File "/home/steveharman/.local/lib/python3.9/site-packages/porkbun_ddns/porkbun_ddns.py", line 11, in <module>
    class PorkbunDDNS():
  File "/home/steveharman/.local/lib/python3.9/site-packages/porkbun_ddns/porkbun_ddns.py", line 17, in PorkbunDDNS
    config: dict | str,
TypeError: unsupported operand type(s) for |: 'type' and 'type'
steveharman@raspberrypi:~ $

Just wondered if you had any ideas on what I'm doing wrong, please?

Thanks

IPV6 not working

When i run porkbun-ddns -v porkbun.json example.com I get message saying No IPv6 connectivity! I have an IPV6 address and can ping -6 google.com and get a reply.
Just tested this works in version 0.2 but fails in 0.3 and 0.4.

Cannot obtain requested address error in logs

I've been seeing errors a few times a day in my porkbun-ddns logs to this effect:

Traceback (most recent call last):
2024-05-01 15:19:57
File "/usr/local/lib/python3.12/urllib/request.py", line 1344, in do_open
2024-05-01 15:19:57
h.request(req.get_method(), req.selector, req.data, headers,
2024-05-01 15:19:57
File "/usr/local/lib/python3.12/http/client.py", line 1336, in request
2024-05-01 15:19:57
self._send_request(method, url, body, headers, encode_chunked)
2024-05-01 15:19:57
File "/usr/local/lib/python3.12/http/client.py", line 1382, in _send_request
2024-05-01 15:19:57
self.endheaders(body, encode_chunked=encode_chunked)
2024-05-01 15:19:57
File "/usr/local/lib/python3.12/http/client.py", line 1331, in endheaders
2024-05-01 15:19:57
self._send_output(message_body, encode_chunked=encode_chunked)
2024-05-01 15:19:57
File "/usr/local/lib/python3.12/http/client.py", line 1091, in _send_output
2024-05-01 15:19:57
self.send(msg)
2024-05-01 15:19:57
File "/usr/local/lib/python3.12/http/client.py", line 1035, in send
2024-05-01 15:19:57
self.connect()
2024-05-01 15:19:57
File "/usr/local/lib/python3.12/http/client.py", line 1470, in connect
2024-05-01 15:19:57
super().connect()
2024-05-01 15:19:57
File "/usr/local/lib/python3.12/http/client.py", line 1001, in connect
2024-05-01 15:19:57
self.sock = self._create_connection(
2024-05-01 15:19:57
^^^^^^^^^^^^^^^^^^^^^^^^
2024-05-01 15:19:57
File "/usr/local/lib/python3.12/socket.py", line 852, in create_connection
2024-05-01 15:19:57
raise exceptions[0]
2024-05-01 15:19:57
File "/usr/local/lib/python3.12/socket.py", line 837, in create_connection
2024-05-01 15:19:57
sock.connect(sa)
2024-05-01 15:19:57
OSError: [Errno 99] Cannot assign requested address
2024-05-01 15:19:57
2024-05-01 15:19:57
During handling of the above exception, another exception occurred:
2024-05-01 15:19:57
2024-05-01 15:19:57
Traceback (most recent call last):
2024-05-01 15:19:57
File "/entrypoint.py", line 61, in
2024-05-01 15:19:57
porkbun_ddns.update_records()
2024-05-01 15:19:57
File "/usr/local/lib/python3.12/site-packages/porkbun_ddns-1.0.0-py3.12.egg/porkbun_ddns/porkbun_ddns.py", line 131, in update_records
2024-05-01 15:19:57
File "/usr/local/lib/python3.12/site-packages/porkbun_ddns-1.0.0-py3.12.egg/porkbun_ddns/porkbun_ddns.py", line 118, in get_records
2024-05-01 15:19:57
File "/usr/local/lib/python3.12/site-packages/porkbun_ddns-1.0.0-py3.12.egg/porkbun_ddns/porkbun_ddns.py", line 107, in _api
2024-05-01 15:19:57
File "/usr/local/lib/python3.12/urllib/request.py", line 215, in urlopen
2024-05-01 15:19:57
return opener.open(url, data, timeout)
2024-05-01 15:19:57
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-05-01 15:19:57
File "/usr/local/lib/python3.12/urllib/request.py", line 515, in open
2024-05-01 15:19:57
response = self._open(req, data)
2024-05-01 15:19:57
^^^^^^^^^^^^^^^^^^^^^
2024-05-01 15:19:57
File "/usr/local/lib/python3.12/urllib/request.py", line 532, in _open
2024-05-01 15:19:57
result = self._call_chain(self.handle_open, protocol, protocol +
2024-05-01 15:19:57
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-05-01 15:19:57
File "/usr/local/lib/python3.12/urllib/request.py", line 492, in _call_chain
2024-05-01 15:19:57
result = func(*args)
2024-05-01 15:19:57
^^^^^^^^^^^
2024-05-01 15:19:57
File "/usr/local/lib/python3.12/urllib/request.py", line 1392, in https_open
2024-05-01 15:19:57
return self.do_open(http.client.HTTPSConnection, req,
2024-05-01 15:19:57
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-05-01 15:19:57
File "/usr/local/lib/python3.12/urllib/request.py", line 1347, in do_open
2024-05-01 15:19:57
raise URLError(err)
2024-05-01 15:19:57
urllib.error.URLError: <urlopen error [Errno 99] Cannot assign requested address>

The script seems to recover after that and the logs go back to successfully checking my A records. Not sure if it's actually a problem, but kind of weird to see.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.