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

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

Closed
mietzen opened this issue Jul 23, 2023 · 2 comments
Closed

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

mietzen opened this issue Jul 23, 2023 · 2 comments

Comments

@mietzen
Copy link
Owner

mietzen commented Jul 23, 2023

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/python@3.11/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/python@3.11/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/python@3.11/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/python@3.11/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/python@3.11/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/python@3.11/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: 
@steveharman
Copy link

I've also observed this when the A record doesn't yet exist.

mietzen added a commit that referenced this issue Jul 29, 2023
@mietzen
Copy link
Owner Author

mietzen commented Jul 29, 2023

Fixed in: v0.1.5

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

2 participants