dynamicdns 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dynamicdns-0.1.0/.editorconfig +11 -0
- dynamicdns-0.1.0/.github/FUNDING.yml +3 -0
- dynamicdns-0.1.0/.github/labels.yml +93 -0
- dynamicdns-0.1.0/.github/release-drafter.yml +96 -0
- dynamicdns-0.1.0/.github/workflows/build.yml +85 -0
- dynamicdns-0.1.0/.github/workflows/draft.yml +26 -0
- dynamicdns-0.1.0/.github/workflows/labeler.yml +21 -0
- dynamicdns-0.1.0/.gitignore +115 -0
- dynamicdns-0.1.0/.vscode/settings.json +4 -0
- dynamicdns-0.1.0/LICENSE.txt +9 -0
- dynamicdns-0.1.0/PKG-INFO +48 -0
- dynamicdns-0.1.0/README.md +23 -0
- dynamicdns-0.1.0/pyproject.toml +95 -0
- dynamicdns-0.1.0/src/dynamicdns/__init__.py +14 -0
- dynamicdns-0.1.0/src/dynamicdns/const.py +15 -0
- dynamicdns-0.1.0/src/dynamicdns/providers.py +107 -0
- dynamicdns-0.1.0/src/dynamicdns/updater.py +37 -0
- dynamicdns-0.1.0/tests/__init__.py +3 -0
@@ -0,0 +1,93 @@
|
|
1
|
+
---
|
2
|
+
# Labels names are important as they are used by Release Drafter to decide
|
3
|
+
# regarding where to record them in changelog or if to skip them.
|
4
|
+
#
|
5
|
+
# The repository labels will be automatically configured using this file and
|
6
|
+
# the GitHub Action https://github.com/marketplace/actions/github-labeler.
|
7
|
+
- name: ':boom: breaking change'
|
8
|
+
from_name: breaking
|
9
|
+
description: Breaking Changes
|
10
|
+
color: bfd4f2
|
11
|
+
- name: ':ghost: bug'
|
12
|
+
from_name: bug
|
13
|
+
description: Something isn't working
|
14
|
+
color: d73a4a
|
15
|
+
- name: ':building_construction: build'
|
16
|
+
from_name: build
|
17
|
+
description: Build System and Dependencies
|
18
|
+
color: bfdadc
|
19
|
+
- name: ':construction_worker_woman: ci'
|
20
|
+
from_name: ci
|
21
|
+
description: Continuous Integration
|
22
|
+
color: 4a97d6
|
23
|
+
- name: ':recycle: dependencies'
|
24
|
+
from_name: dependencies
|
25
|
+
description: Pull requests that update a dependency file
|
26
|
+
color: 0366d6
|
27
|
+
- name: ':book: documentation'
|
28
|
+
from_name: documentation
|
29
|
+
description: Improvements or additions to documentation
|
30
|
+
color: 0075ca
|
31
|
+
- name: ':roll_eyes: duplicate'
|
32
|
+
from_name: duplicate
|
33
|
+
description: This issue or pull request already exists
|
34
|
+
color: cfd3d7
|
35
|
+
- name: ':rocket: feature'
|
36
|
+
from_name: enhancement
|
37
|
+
description: New feature or request
|
38
|
+
color: a2eeef
|
39
|
+
- name: ':clapper: github_actions'
|
40
|
+
from_name: github_actions
|
41
|
+
description: Pull requests that update Github_actions code
|
42
|
+
color: '000000'
|
43
|
+
- name: ':hatching_chick: good first issue'
|
44
|
+
from_name: good first issue
|
45
|
+
description: Good for newcomers
|
46
|
+
color: 7057ff
|
47
|
+
- name: ':pray: help wanted'
|
48
|
+
from_name: help wanted
|
49
|
+
description: Extra attention is needed
|
50
|
+
color: '008672'
|
51
|
+
- name: ':no_entry_sign: invalid'
|
52
|
+
from_name: invalid
|
53
|
+
description: This doesn't seem right
|
54
|
+
color: e4e669
|
55
|
+
- name: ':racing_car: performance'
|
56
|
+
from_name: performance
|
57
|
+
description: Performance
|
58
|
+
color: '016175'
|
59
|
+
- name: ':snake: python'
|
60
|
+
from_name: python
|
61
|
+
description: Pull requests that update Python code
|
62
|
+
color: 2b67c6
|
63
|
+
- name: ':question: question'
|
64
|
+
from_name: question
|
65
|
+
description: Further information is requested
|
66
|
+
color: d876e3
|
67
|
+
- name: ':sparkles: code quality'
|
68
|
+
from_name: code quality
|
69
|
+
description: Code quality improvements
|
70
|
+
color: ef67c4
|
71
|
+
- name: ':file_cabinet: deprecation'
|
72
|
+
from_name: deprecation
|
73
|
+
description: Removals and Deprecations
|
74
|
+
color: 9ae7ea
|
75
|
+
- name: ':nail_care: style'
|
76
|
+
from_name: style
|
77
|
+
description: Style
|
78
|
+
color: c120e5
|
79
|
+
- name: ':test_tube: testing'
|
80
|
+
from_name: testing
|
81
|
+
description: Pull request that adds tests
|
82
|
+
color: b1fc6f
|
83
|
+
- name: ':woman_shrugging: wontfix'
|
84
|
+
from_name: wontfix
|
85
|
+
description: This will not be worked on
|
86
|
+
color: ffffff
|
87
|
+
- name: ':arrow_up: bump'
|
88
|
+
description: Bump the version
|
89
|
+
color: 3C5D34
|
90
|
+
- name: ':sparkles: enhancement'
|
91
|
+
color: CBF8DA
|
92
|
+
- name: 'skip-changelog'
|
93
|
+
color: D3D3D3
|
@@ -0,0 +1,96 @@
|
|
1
|
+
name-template: "v$RESOLVED_VERSION"
|
2
|
+
tag-template: "v$RESOLVED_VERSION"
|
3
|
+
|
4
|
+
categories:
|
5
|
+
- title: "💥 Breaking changes"
|
6
|
+
labels:
|
7
|
+
- ":boom: breaking change"
|
8
|
+
- title: "🚀 New Features"
|
9
|
+
labels:
|
10
|
+
- ":rocket: feature"
|
11
|
+
- title: "👻 Bug Fixes"
|
12
|
+
labels:
|
13
|
+
- ":ghost: bug"
|
14
|
+
- title: "⏳ Deprecations"
|
15
|
+
labels:
|
16
|
+
- ":file_cabinet: deprecation"
|
17
|
+
- title: "📃 Documentation"
|
18
|
+
labels:
|
19
|
+
- ":book: documentation"
|
20
|
+
- title: "🧰 Maintenance"
|
21
|
+
labels:
|
22
|
+
- ":building_construction: build"
|
23
|
+
- ":construction_worker_woman: ci"
|
24
|
+
- ":clapper: github_actions"
|
25
|
+
collapse-after: 5
|
26
|
+
- title: "🔬 Other updates"
|
27
|
+
labels:
|
28
|
+
- ":nail_care: style"
|
29
|
+
- ":test_tube: testing"
|
30
|
+
- ":racing_car: performance"
|
31
|
+
- ":sparkles: code quality"
|
32
|
+
- ":sparkles: enhancement"
|
33
|
+
- title: "🧩 Dependency Updates"
|
34
|
+
labels:
|
35
|
+
- ":recycle: dependencies"
|
36
|
+
collapse-after: 5
|
37
|
+
exclude-labels:
|
38
|
+
- ":arrow_up: bump"
|
39
|
+
- "skip-changelog"
|
40
|
+
|
41
|
+
autolabeler:
|
42
|
+
- label: ":rocket: feature"
|
43
|
+
title:
|
44
|
+
- "/adds/i"
|
45
|
+
- "/add method/i"
|
46
|
+
- label: ":ghost: bug"
|
47
|
+
title:
|
48
|
+
- "/fix/i"
|
49
|
+
- label: ":sparkles: code quality"
|
50
|
+
title:
|
51
|
+
- "/Refactor/i"
|
52
|
+
- label: ":test_tube: testing"
|
53
|
+
files:
|
54
|
+
- "test_*"
|
55
|
+
- "conftest.py"
|
56
|
+
- label: ":book: documentation"
|
57
|
+
title:
|
58
|
+
- "/docs:/i"
|
59
|
+
files:
|
60
|
+
- "*.md"
|
61
|
+
- "mkdocs.yml"
|
62
|
+
- label: ":construction_worker_woman: ci"
|
63
|
+
files:
|
64
|
+
- ".github/*"
|
65
|
+
- label: ":recycle: dependencies"
|
66
|
+
title:
|
67
|
+
- "/^bump(?! version)/i"
|
68
|
+
- label: ":file_cabinet: deprecation"
|
69
|
+
title:
|
70
|
+
- "/Deprecate/i"
|
71
|
+
|
72
|
+
change-template: "- $TITLE @$AUTHOR (#$NUMBER)"
|
73
|
+
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
|
74
|
+
exclude-contributors:
|
75
|
+
- "dependabot"
|
76
|
+
- "renovate"
|
77
|
+
|
78
|
+
version-resolver:
|
79
|
+
major:
|
80
|
+
labels:
|
81
|
+
- ":boom: breaking change"
|
82
|
+
minor:
|
83
|
+
labels:
|
84
|
+
- ":rocket: feature"
|
85
|
+
default: patch
|
86
|
+
|
87
|
+
template: |
|
88
|
+
## What's Changed
|
89
|
+
|
90
|
+
$CHANGES
|
91
|
+
|
92
|
+
Contributors: $CONTRIBUTORS
|
93
|
+
|
94
|
+
replacers:
|
95
|
+
- search: '/(?:and )?@dependabot(?:\[bot\])?,?/g'
|
96
|
+
replace: ""
|
@@ -0,0 +1,85 @@
|
|
1
|
+
name: Build
|
2
|
+
|
3
|
+
on: [push, pull_request]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
test:
|
7
|
+
runs-on: ubuntu-latest
|
8
|
+
steps:
|
9
|
+
- uses: actions/checkout@v5
|
10
|
+
- uses: actions/setup-python@v6
|
11
|
+
with:
|
12
|
+
python-version: "3.13"
|
13
|
+
- name: Install dependencies
|
14
|
+
run: |
|
15
|
+
pipx install hatch --python python3.13
|
16
|
+
pipx inject hatch click==8.2.1 --force
|
17
|
+
- name: Lint and typecheck
|
18
|
+
run: |
|
19
|
+
hatch fmt --check
|
20
|
+
hatch run types:check
|
21
|
+
# - name: Test
|
22
|
+
# run: |
|
23
|
+
# hatch test --all
|
24
|
+
|
25
|
+
# - uses: codecov/codecov-action@v5
|
26
|
+
# with:
|
27
|
+
# token: ${{ secrets.CODECOV_TOKEN }}
|
28
|
+
# fail_ci_if_error: true
|
29
|
+
# verbose: true
|
30
|
+
|
31
|
+
release:
|
32
|
+
runs-on: ubuntu-latest
|
33
|
+
environment: release
|
34
|
+
needs: test
|
35
|
+
if: startsWith(github.ref, 'refs/tags/')
|
36
|
+
permissions:
|
37
|
+
contents: write
|
38
|
+
id-token: write
|
39
|
+
|
40
|
+
steps:
|
41
|
+
- uses: actions/checkout@v5
|
42
|
+
- name: Install dependencies
|
43
|
+
shell: bash
|
44
|
+
run: pipx install hatch
|
45
|
+
- name: mint API token
|
46
|
+
id: mint-token
|
47
|
+
run: |
|
48
|
+
# retrieve the ambient OIDC token
|
49
|
+
resp=$(curl -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \
|
50
|
+
"$ACTIONS_ID_TOKEN_REQUEST_URL&audience=pypi")
|
51
|
+
oidc_token=$(jq -r '.value' <<< "${resp}")
|
52
|
+
|
53
|
+
# exchange the OIDC token for an API token
|
54
|
+
resp=$(curl -X POST https://pypi.org/_/oidc/mint-token -d "{\"token\": \"${oidc_token}\"}")
|
55
|
+
api_token=$(jq -r '.token' <<< "${resp}")
|
56
|
+
|
57
|
+
# mask the newly minted API token, so that we don't accidentally leak it
|
58
|
+
echo "::add-mask::${api_token}"
|
59
|
+
|
60
|
+
# see the next step in the workflow for an example of using this step output
|
61
|
+
echo "api-token=${api_token}" >> "${GITHUB_OUTPUT}"
|
62
|
+
- name: Build and publish on PyPI
|
63
|
+
env:
|
64
|
+
HATCH_INDEX_USER: __token__
|
65
|
+
HATCH_INDEX_AUTH: ${{ steps.mint-token.outputs.api-token }}
|
66
|
+
run: |
|
67
|
+
hatch build
|
68
|
+
hatch publish
|
69
|
+
- name: Create release
|
70
|
+
uses: ncipollo/release-action@v1
|
71
|
+
with:
|
72
|
+
draft: true
|
73
|
+
body: ${{ github.event.head_commit.message }}
|
74
|
+
allowUpdates: true
|
75
|
+
omitBodyDuringUpdate: true
|
76
|
+
updateOnlyUnreleased: true
|
77
|
+
artifacts: dist/*.whl,dist/*.tar.gz
|
78
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
79
|
+
- name: Upload distributions
|
80
|
+
uses: actions/upload-artifact@v4
|
81
|
+
with:
|
82
|
+
name: release-dists
|
83
|
+
path: |
|
84
|
+
dist/*.whl
|
85
|
+
dist/*.tar.gz
|
@@ -0,0 +1,26 @@
|
|
1
|
+
name: Release Drafter
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- main
|
7
|
+
# pull_request event is required only for autolabeler
|
8
|
+
pull_request:
|
9
|
+
types: [opened, reopened, synchronize]
|
10
|
+
pull_request_target:
|
11
|
+
types: [opened, reopened, synchronize]
|
12
|
+
|
13
|
+
permissions:
|
14
|
+
contents: read
|
15
|
+
|
16
|
+
jobs:
|
17
|
+
update-draft:
|
18
|
+
runs-on: ubuntu-latest
|
19
|
+
permissions:
|
20
|
+
contents: write
|
21
|
+
pull-requests: write
|
22
|
+
steps:
|
23
|
+
# Drafts your next Release notes as Pull Requests are merged into "main"
|
24
|
+
- uses: release-drafter/release-drafter@v6
|
25
|
+
env:
|
26
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
name: Labeler
|
2
|
+
|
3
|
+
on: workflow_dispatch
|
4
|
+
|
5
|
+
permissions:
|
6
|
+
actions: read
|
7
|
+
contents: read
|
8
|
+
security-events: write
|
9
|
+
pull-requests: write
|
10
|
+
|
11
|
+
jobs:
|
12
|
+
labeler:
|
13
|
+
runs-on: ubuntu-latest
|
14
|
+
steps:
|
15
|
+
- name: Check out the repository
|
16
|
+
uses: actions/checkout@v5
|
17
|
+
|
18
|
+
- name: Run Labeler
|
19
|
+
uses: crazy-max/ghaction-github-labeler@v5.3.0
|
20
|
+
with:
|
21
|
+
skip-delete: true
|
@@ -0,0 +1,115 @@
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
2
|
+
__pycache__/
|
3
|
+
*.py[cod]
|
4
|
+
*$py.class
|
5
|
+
|
6
|
+
# C extensions
|
7
|
+
*.so
|
8
|
+
|
9
|
+
# Distribution / packaging
|
10
|
+
.Python
|
11
|
+
env/
|
12
|
+
build/
|
13
|
+
develop-eggs/
|
14
|
+
dist/
|
15
|
+
downloads/
|
16
|
+
eggs/
|
17
|
+
.eggs/
|
18
|
+
lib/
|
19
|
+
lib64/
|
20
|
+
parts/
|
21
|
+
sdist/
|
22
|
+
var/
|
23
|
+
wheels/
|
24
|
+
*.egg-info/
|
25
|
+
.installed.cfg
|
26
|
+
*.egg
|
27
|
+
|
28
|
+
# PyInstaller
|
29
|
+
# Usually these files are written by a python script from a template
|
30
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
31
|
+
*.manifest
|
32
|
+
*.spec
|
33
|
+
|
34
|
+
# Installer logs
|
35
|
+
pip-log.txt
|
36
|
+
pip-delete-this-directory.txt
|
37
|
+
|
38
|
+
# Unit test / coverage reports
|
39
|
+
htmlcov/
|
40
|
+
.tox/
|
41
|
+
.coverage
|
42
|
+
.coverage.*
|
43
|
+
.cache
|
44
|
+
nosetests.xml
|
45
|
+
coverage.xml
|
46
|
+
*.cover
|
47
|
+
.hypothesis/
|
48
|
+
.pytest_cache/
|
49
|
+
junit/
|
50
|
+
junit.xml
|
51
|
+
test.db
|
52
|
+
|
53
|
+
# Translations
|
54
|
+
*.mo
|
55
|
+
*.pot
|
56
|
+
|
57
|
+
# Django stuff:
|
58
|
+
*.log
|
59
|
+
local_settings.py
|
60
|
+
|
61
|
+
# Flask stuff:
|
62
|
+
instance/
|
63
|
+
.webassets-cache
|
64
|
+
|
65
|
+
# Scrapy stuff:
|
66
|
+
.scrapy
|
67
|
+
|
68
|
+
# Sphinx documentation
|
69
|
+
docs/_build/
|
70
|
+
|
71
|
+
# PyBuilder
|
72
|
+
target/
|
73
|
+
|
74
|
+
# Jupyter Notebook
|
75
|
+
.ipynb_checkpoints
|
76
|
+
*.ipynb
|
77
|
+
|
78
|
+
# pyenv
|
79
|
+
.python-version
|
80
|
+
|
81
|
+
# celery beat schedule file
|
82
|
+
celerybeat-schedule
|
83
|
+
|
84
|
+
# SageMath parsed files
|
85
|
+
*.sage.py
|
86
|
+
|
87
|
+
# dotenv
|
88
|
+
.env
|
89
|
+
|
90
|
+
# virtualenv
|
91
|
+
.venv
|
92
|
+
venv/
|
93
|
+
ENV/
|
94
|
+
|
95
|
+
# Spyder project settings
|
96
|
+
.spyderproject
|
97
|
+
.spyproject
|
98
|
+
|
99
|
+
# Rope project settings
|
100
|
+
.ropeproject
|
101
|
+
|
102
|
+
# mkdocs documentation
|
103
|
+
/site
|
104
|
+
|
105
|
+
# mypy
|
106
|
+
.mypy_cache/
|
107
|
+
|
108
|
+
# OS files
|
109
|
+
.DS_Store
|
110
|
+
|
111
|
+
|
112
|
+
# Avatar test image
|
113
|
+
avatar.png
|
114
|
+
|
115
|
+
*.http
|
@@ -0,0 +1,9 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2025-present tr4nt0r <4445816+tr4nt0r@users.noreply.github.com>
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
6
|
+
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
8
|
+
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -0,0 +1,48 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: dynamicdns
|
3
|
+
Version: 0.1.0
|
4
|
+
Summary: Collection of Dynamic DNS providers
|
5
|
+
Project-URL: Documentation, https://github.com/tr4nt0r/dynamicdns#readme
|
6
|
+
Project-URL: Issues, https://github.com/tr4nt0r/dynamicdns/issues
|
7
|
+
Project-URL: Source, https://github.com/tr4nt0r/dynamicdns
|
8
|
+
Author-email: tr4nt0r <4445816+tr4nt0r@users.noreply.github.com>
|
9
|
+
License-Expression: MIT
|
10
|
+
License-File: LICENSE.txt
|
11
|
+
Classifier: Development Status :: 5 - Production/Stable
|
12
|
+
Classifier: Programming Language :: Python
|
13
|
+
Classifier: Programming Language :: Python :: 3.8
|
14
|
+
Classifier: Programming Language :: Python :: 3.9
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
18
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
19
|
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
20
|
+
Requires-Python: >=3.8
|
21
|
+
Requires-Dist: aiohttp>=3.12
|
22
|
+
Requires-Dist: voluptuous>=0.15
|
23
|
+
Requires-Dist: yarl>=1.20
|
24
|
+
Description-Content-Type: text/markdown
|
25
|
+
|
26
|
+
# DynamicDNS
|
27
|
+
|
28
|
+
[](https://pypi.org/project/dynamicdns)
|
29
|
+
[](https://pypi.org/project/dynamicdns)
|
30
|
+
|
31
|
+
-----
|
32
|
+
|
33
|
+
## Table of Contents
|
34
|
+
|
35
|
+
- [DynamicDNS](#dynamicdns)
|
36
|
+
- [Table of Contents](#table-of-contents)
|
37
|
+
- [Installation](#installation)
|
38
|
+
- [License](#license)
|
39
|
+
|
40
|
+
## Installation
|
41
|
+
|
42
|
+
```console
|
43
|
+
pip install dynamicdns
|
44
|
+
```
|
45
|
+
|
46
|
+
## License
|
47
|
+
|
48
|
+
`dynamicdns` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# DynamicDNS
|
2
|
+
|
3
|
+
[](https://pypi.org/project/dynamicdns)
|
4
|
+
[](https://pypi.org/project/dynamicdns)
|
5
|
+
|
6
|
+
-----
|
7
|
+
|
8
|
+
## Table of Contents
|
9
|
+
|
10
|
+
- [DynamicDNS](#dynamicdns)
|
11
|
+
- [Table of Contents](#table-of-contents)
|
12
|
+
- [Installation](#installation)
|
13
|
+
- [License](#license)
|
14
|
+
|
15
|
+
## Installation
|
16
|
+
|
17
|
+
```console
|
18
|
+
pip install dynamicdns
|
19
|
+
```
|
20
|
+
|
21
|
+
## License
|
22
|
+
|
23
|
+
`dynamicdns` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.
|
@@ -0,0 +1,95 @@
|
|
1
|
+
[build-system]
|
2
|
+
requires = ["hatchling", "hatch-regex-commit"]
|
3
|
+
build-backend = "hatchling.build"
|
4
|
+
|
5
|
+
[project]
|
6
|
+
name = "dynamicdns"
|
7
|
+
dynamic = ["version"]
|
8
|
+
description = 'Collection of Dynamic DNS providers'
|
9
|
+
readme = "README.md"
|
10
|
+
requires-python = ">=3.8"
|
11
|
+
license = "MIT"
|
12
|
+
keywords = []
|
13
|
+
authors = [
|
14
|
+
{ name = "tr4nt0r", email = "4445816+tr4nt0r@users.noreply.github.com" },
|
15
|
+
]
|
16
|
+
classifiers = [
|
17
|
+
"Development Status :: 5 - Production/Stable",
|
18
|
+
"Programming Language :: Python",
|
19
|
+
"Programming Language :: Python :: 3.8",
|
20
|
+
"Programming Language :: Python :: 3.9",
|
21
|
+
"Programming Language :: Python :: 3.10",
|
22
|
+
"Programming Language :: Python :: 3.11",
|
23
|
+
"Programming Language :: Python :: 3.12",
|
24
|
+
"Programming Language :: Python :: Implementation :: CPython",
|
25
|
+
"Programming Language :: Python :: Implementation :: PyPy",
|
26
|
+
]
|
27
|
+
dependencies = ["aiohttp>=3.12", "yarl>=1.20", "voluptuous>=0.15"]
|
28
|
+
|
29
|
+
[project.urls]
|
30
|
+
Documentation = "https://github.com/tr4nt0r/dynamicdns#readme"
|
31
|
+
Issues = "https://github.com/tr4nt0r/dynamicdns/issues"
|
32
|
+
Source = "https://github.com/tr4nt0r/dynamicdns"
|
33
|
+
|
34
|
+
[tool.hatch.version]
|
35
|
+
source = "regex_commit"
|
36
|
+
commit_extra_args = ["-e"]
|
37
|
+
path = "src/dynamicdns/__init__.py"
|
38
|
+
|
39
|
+
[tool.hatch.envs.default]
|
40
|
+
python = "3.13"
|
41
|
+
dependencies = [
|
42
|
+
"aiohttp==3.12.15",
|
43
|
+
"yarl==1.20.1",
|
44
|
+
"voluptuous==0.15.2"
|
45
|
+
]
|
46
|
+
|
47
|
+
[tool.hatch.envs.hatch-static-analysis]
|
48
|
+
config-path = "none"
|
49
|
+
dependencies = [
|
50
|
+
"ruff==0.13.2"
|
51
|
+
]
|
52
|
+
|
53
|
+
[tool.hatch.envs.hatch-test]
|
54
|
+
parallel = true
|
55
|
+
extra-dependencies = [
|
56
|
+
"pytest==8.4.1",
|
57
|
+
"pytest-cov==6.2.1",
|
58
|
+
"pytest-asyncio==1.1.0",
|
59
|
+
]
|
60
|
+
[tool.hatch.envs.types]
|
61
|
+
extra-dependencies = [
|
62
|
+
"mypy==1.18.2",
|
63
|
+
]
|
64
|
+
[tool.hatch.envs.types.scripts]
|
65
|
+
check = "mypy --install-types --non-interactive {args:src/dynamicdns tests}"
|
66
|
+
|
67
|
+
[tool.coverage.run]
|
68
|
+
source_pkgs = ["dynamicdns", "tests"]
|
69
|
+
branch = true
|
70
|
+
parallel = true
|
71
|
+
|
72
|
+
|
73
|
+
[tool.coverage.paths]
|
74
|
+
dynamicdns = ["src/dynamicdns", "*/dynamicdns/src/dynamicdns"]
|
75
|
+
tests = ["tests", "*/dynamicdns/tests"]
|
76
|
+
|
77
|
+
[tool.coverage.report]
|
78
|
+
exclude_lines = [
|
79
|
+
"no cov",
|
80
|
+
"if __name__ == .__main__.:",
|
81
|
+
"if TYPE_CHECKING:",
|
82
|
+
]
|
83
|
+
|
84
|
+
[tool.ruff.lint.isort]
|
85
|
+
force-sort-within-sections = true
|
86
|
+
known-first-party = ["dynamicdns"]
|
87
|
+
combine-as-imports = true
|
88
|
+
split-on-trailing-comma = false
|
89
|
+
|
90
|
+
[tool.ruff.lint.pydocstyle]
|
91
|
+
convention = "numpy"
|
92
|
+
|
93
|
+
[tool.ruff.format]
|
94
|
+
quote-style = "double"
|
95
|
+
indent-style = "space"
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# SPDX-FileCopyrightText: 2025-present tr4nt0r <4445816+tr4nt0r@users.noreply.github.com>
|
2
|
+
#
|
3
|
+
# SPDX-License-Identifier: MIT
|
4
|
+
|
5
|
+
from .providers import Provider, ProviderConf, providers
|
6
|
+
from .updater import Updater
|
7
|
+
|
8
|
+
__version__ = "0.1.0"
|
9
|
+
__all__ = [
|
10
|
+
"providers",
|
11
|
+
"Provider",
|
12
|
+
"ProviderConf",
|
13
|
+
"Updater",
|
14
|
+
]
|
@@ -0,0 +1,15 @@
|
|
1
|
+
"""Constants."""
|
2
|
+
|
3
|
+
from typing import Final
|
4
|
+
|
5
|
+
CONF_HOSTS: Final = "hosts"
|
6
|
+
CONF_HOST: Final = "host"
|
7
|
+
CONF_TOKEN: Final = "token"
|
8
|
+
CONF_USERNAME: Final = "username"
|
9
|
+
CONF_PASSWORD: Final = "password"
|
10
|
+
CONF_IP_ADDRESS: Final = "ip_address"
|
11
|
+
CONF_IPV6_ADDRESS: Final = "ipv6_address"
|
12
|
+
CONF_VERBOSE: Final = "verbose"
|
13
|
+
CONF_TXT: Final = "txt"
|
14
|
+
CONF_CLEAR: Final = "clear"
|
15
|
+
CONF_DOMAIN: Final = "domain"
|
@@ -0,0 +1,107 @@
|
|
1
|
+
"""List of dynamic DNS providers."""
|
2
|
+
|
3
|
+
from __future__ import annotations
|
4
|
+
|
5
|
+
from dataclasses import dataclass, field
|
6
|
+
from enum import StrEnum
|
7
|
+
from typing import Callable
|
8
|
+
|
9
|
+
import voluptuous as vol
|
10
|
+
from yarl import URL
|
11
|
+
|
12
|
+
from .const import (
|
13
|
+
CONF_DOMAIN,
|
14
|
+
CONF_HOST,
|
15
|
+
CONF_IP_ADDRESS,
|
16
|
+
CONF_IPV6_ADDRESS,
|
17
|
+
CONF_PASSWORD,
|
18
|
+
CONF_TOKEN,
|
19
|
+
CONF_USERNAME,
|
20
|
+
)
|
21
|
+
|
22
|
+
|
23
|
+
class Provider(StrEnum):
|
24
|
+
"""Dynamic DNS providers."""
|
25
|
+
|
26
|
+
DUCKDNS = "duckdns"
|
27
|
+
MYTHICBEASTS_IPV4 = "mythicbeasts_ipv4"
|
28
|
+
ANYDNS = "anydns"
|
29
|
+
FREEDNS = "freedns"
|
30
|
+
FREEDNS_IPV6 = "freedns_ipv6"
|
31
|
+
|
32
|
+
|
33
|
+
@dataclass(frozen=True, kw_only=True)
|
34
|
+
class ProviderConf:
|
35
|
+
"""Dynamic DNS provider config."""
|
36
|
+
|
37
|
+
name: str
|
38
|
+
base_url: str
|
39
|
+
method: str = "GET"
|
40
|
+
params: dict[str, str] = field(default_factory=dict)
|
41
|
+
schema: vol.Schema
|
42
|
+
success_fn: Callable[[str], bool] | None = None
|
43
|
+
|
44
|
+
def render_url(self, data: dict[str, str]) -> URL:
|
45
|
+
"""Render the provider URL with given data and remove unused query parameters."""
|
46
|
+
|
47
|
+
url = URL(self.base_url)
|
48
|
+
url = url.with_path(url.path.format(**data))
|
49
|
+
return url % {k: data[v] for k, v in self.params.items() if v in data}
|
50
|
+
|
51
|
+
|
52
|
+
providers: dict[Provider, ProviderConf] = {
|
53
|
+
Provider.DUCKDNS: ProviderConf(
|
54
|
+
name="Duck DNS",
|
55
|
+
base_url="https://www.duckdns.org/update?verbose=true",
|
56
|
+
params={
|
57
|
+
"domains": CONF_HOST,
|
58
|
+
"token": CONF_TOKEN,
|
59
|
+
"ip": CONF_IP_ADDRESS,
|
60
|
+
"ipv6": CONF_IPV6_ADDRESS,
|
61
|
+
},
|
62
|
+
schema=vol.Schema(
|
63
|
+
{
|
64
|
+
vol.Required(CONF_HOST): str,
|
65
|
+
vol.Required(CONF_TOKEN): vol.All(str, vol.Length(min=36, max=36)),
|
66
|
+
}
|
67
|
+
),
|
68
|
+
success_fn=lambda x: x.startswith("OK"),
|
69
|
+
),
|
70
|
+
Provider.MYTHICBEASTS_IPV4: ProviderConf(
|
71
|
+
name="Mythic Beasts IPv4",
|
72
|
+
base_url="https://ipv4.api.mythic-beasts.com/dns/v2/dynamic/{domain}",
|
73
|
+
method="POST",
|
74
|
+
params={"username": CONF_USERNAME, "password": CONF_PASSWORD},
|
75
|
+
schema=vol.Schema(
|
76
|
+
{
|
77
|
+
vol.Required(CONF_DOMAIN): str,
|
78
|
+
vol.Required(CONF_USERNAME): str,
|
79
|
+
vol.Required(CONF_PASSWORD): str,
|
80
|
+
},
|
81
|
+
),
|
82
|
+
),
|
83
|
+
Provider.ANYDNS: ProviderConf(
|
84
|
+
name="AnyDNS.info",
|
85
|
+
base_url="https://anydns.info/update.php",
|
86
|
+
params={"host": CONF_HOST, "user": CONF_USERNAME, "password": CONF_PASSWORD},
|
87
|
+
schema=vol.Schema(
|
88
|
+
{
|
89
|
+
vol.Required(CONF_HOST): str,
|
90
|
+
vol.Required(CONF_USERNAME): str,
|
91
|
+
vol.Required(CONF_PASSWORD): str,
|
92
|
+
},
|
93
|
+
),
|
94
|
+
),
|
95
|
+
Provider.FREEDNS: ProviderConf(
|
96
|
+
name="FreeDNS IPv4",
|
97
|
+
base_url="https://sync.afraid.org/u/{token}/",
|
98
|
+
schema=vol.Schema({vol.Required(CONF_TOKEN): str}),
|
99
|
+
success_fn=lambda x: x.startswith(("Updated", "No IP change")),
|
100
|
+
),
|
101
|
+
Provider.FREEDNS_IPV6: ProviderConf(
|
102
|
+
name="FreeDNS IPv6",
|
103
|
+
base_url="https://v6.sync.afraid.org/u/{token}",
|
104
|
+
schema=vol.Schema({vol.Required(CONF_TOKEN): str}),
|
105
|
+
success_fn=lambda x: x.startswith(("Updated", "No IP change")),
|
106
|
+
),
|
107
|
+
}
|
@@ -0,0 +1,37 @@
|
|
1
|
+
"""Dynamic DNS updater."""
|
2
|
+
|
3
|
+
from __future__ import annotations
|
4
|
+
|
5
|
+
import logging
|
6
|
+
|
7
|
+
from aiohttp import ClientSession
|
8
|
+
|
9
|
+
from .providers import Provider, providers
|
10
|
+
|
11
|
+
_LOGGER = logging.getLogger(__package__)
|
12
|
+
|
13
|
+
|
14
|
+
class Updater:
|
15
|
+
"""Dynamic DNS updater class."""
|
16
|
+
|
17
|
+
def __init__(
|
18
|
+
self,
|
19
|
+
provider: Provider,
|
20
|
+
data: dict[str, str],
|
21
|
+
session: ClientSession,
|
22
|
+
) -> None:
|
23
|
+
"""Initialize."""
|
24
|
+
|
25
|
+
self.session = session
|
26
|
+
self.method = providers[provider].method
|
27
|
+
self.url = providers[provider].render_url(data)
|
28
|
+
self.success = providers[provider].success_fn
|
29
|
+
|
30
|
+
async def update(self) -> bool:
|
31
|
+
"""Update the dynamic DNS record."""
|
32
|
+
|
33
|
+
async with self.session.request(self.method, self.url) as res:
|
34
|
+
_LOGGER.debug(await res.text())
|
35
|
+
return (
|
36
|
+
self.success(await res.text()) if self.success is not None else res.ok
|
37
|
+
)
|