Skip to content

Commit

Permalink
Merge pull request #48 from Domain-Connect/bugfix/issue_46
Browse files Browse the repository at this point in the history
Bugfix/issue 46
  • Loading branch information
pawel-kow authored Apr 14, 2021
2 parents f33308d + 347ef14 commit 136877f
Show file tree
Hide file tree
Showing 9 changed files with 99 additions and 26 deletions.
13 changes: 8 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
language: python
python:
- '3.6'
- "2.7"
- "3.6"
- "3.7"
- "3.8"
- "3.9"
install:
- pip install -r requirements.txt
- pip install pytest-cov
- pip install unittest2
- pip install -r requirements-test.txt
script: py.test --cov=dyndns --cov-config=.coveragerc
deploy:
provider: pypi
user: "__token__"
password:
secure: WbgltkoM1BZQJeTJpm7J/Drvh8vm/L4QPm7+aOIP4Xx2Sw71ClAvPYH5I2Q7Vi6hJ2/5W5jCuxuUaqPYAYWYQLpGp5QwyN7FQVlBbcW3N4aCWDKJKrgn20W0caBIKPVTTh/ZuYEbO52nuccZKOqtiLe3UpbSbSNQO5iDI3aNRhggchZUQ/rIVjESYHOmtyW4dAvfHaoCCOirnP2FNuGyD4f9vlz5kXCLMlVXzma+KMzIwNxL6WJrrzUboPbd47MIDswHHrbGGGB6DzUJP2Bz7d2WRDXQahd+spnr7TDH03K3zu23dv1hYluAGx7AUukYLpeFExRkUohpDF+oqqVHfkft13GRKi2hOHLAvqru27T+lAcfwA4E/KnOy2+7bzCW8lyTegkspBVgEb2dOBH/mxGoV2h01bBBO8Ev7QEt+Xnf+EfCgNnKWBZi4LqRCOU+4P8taSIJt5h0JqpxbXCfEIJjCG+hUUkmEd6suVOxFzA90gWLVUQS3T/4yMRxpCwykrJ66a1IWTgVP6nFvTRJkJ+KuRjsr7rI3hR8L07fDmyjfWNnyaQ/3sBWCXkH2BEJnGU6Z099NmqQ/vlIiVAmRUGG5rASf5cAxh4DkVbmqu98nxC/ZqEKAb3kjZX+lPy20j1L0+1UUOch0RMgtIlF9ipZtKCeROnml6xsvJ9V3Oc=
on:
tags: true
tags: true
skip_existing: true
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [0.0.9] - 2021-04-14

### Changed
- BUGFIX: unhandled exception if not domainconnect record or no settings (Issue #32)
- SETUP: upgraded dependencies and split of requirements.txt
- BUGFIX: support when no webbrowser module (OpenWRT)

## [0.0.8] - 2020-06-30

Expand Down
1 change: 1 addition & 0 deletions dyndns/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__="0.0.9"
4 changes: 4 additions & 0 deletions dyndns/command_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@
from dyndns import domain_update
from dyndns import domain_status
from dyndns import domain_remove
from . import __version__


def main():
parser = argparse.ArgumentParser(description="Config domain for DynDNS")

parser.add_argument('action', choices=['setup', 'update', 'status', 'remove'], help="action to be performed on "
"domain(s)")
parser.add_argument('--version', action='version', version='%(prog)s {version}'.format(version=__version__))
parser.add_argument('--config', type=str, default='settings.txt', help="config file path")
parser.add_argument('--backup_file', default=None, help="backup file path for remove domain")
parser.add_argument('--ignore-previous-ip', action='store_true', dest='ignore_previous_ip',
Expand All @@ -35,6 +37,8 @@ def main():
ignore_ipv4 = "ipv4" not in args.protocols
ignore_ipv6 = "ipv6" not in args.protocols

print('*** {} {} ***\n'.format(parser.prog, __version__))

# validate domain
if domain and not validators.domain(domain) is True:
print("Domain is not valid.")
Expand Down
10 changes: 7 additions & 3 deletions dyndns/domain_setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import json
import os.path
import webbrowser
try:
import webbrowser
except ModuleNotFoundError:
pass
import sys
from builtins import input

from domainconnect import DomainConnect, DomainConnectAsyncCredentials, TemplateNotSupportedException, \
Expand Down Expand Up @@ -43,8 +47,8 @@ def main(domain, protocols, settings='settings.txt'):
params=params,
redirect_uri='https://dynamicdns.domainconnect.org/ddnscode'
)

webbrowser.open(context.asyncConsentUrl, autoraise=True)
if "webbrowser" in sys.modules:
webbrowser.open(context.asyncConsentUrl, autoraise=True)
code = input("Please open\n{}\nand provide us the access code:".format(context.asyncConsentUrl))

tries = 1
Expand Down
4 changes: 2 additions & 2 deletions dyndns/tests/test_dyndns.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def setUp(self):
self.host = 'testing.'
self.domain = 'connect.domains'
self.expected_settings_keys = [
'access_token_expires_in', 'access_token', 'url_api', 'iat', 'provider_name', 'refresh_token'
'access_token_expires_in', 'access_token', 'url_api', 'protocols', 'iat', 'provider_name', 'refresh_token'
]

def tearDown(self):
Expand Down Expand Up @@ -66,7 +66,7 @@ def test_update_domain(self):
domain_setup.main(self.host + self.domain, ['ipv4'])
assert (os.path.exists('settings.txt')), 'Settings file missing'
result = domain_update.main(self.host + self.domain)
assert (result in ['A record up to date.', 'DNS record successfully updated.']), result
assert (result in ['All records up to date. No update required.', 'DNS record successfully updated.']), result


if __name__ == '__main__':
Expand Down
41 changes: 41 additions & 0 deletions requirements-test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
atomicwrites==1.4.0
attrs==20.3.0
backports.functools-lru-cache==1.6.4
certifi==2020.12.5
cffi==1.14.5
chardet==4.0.0
colorama==0.4.4
configparser==4.0.2
contextlib2==0.6.0.post1
coverage==5.5
cryptography==3.3.2
decorator==4.4.2
dnspython==1.16.0
domain-connect==0.0.9
enum34==1.1.10
funcsigs==1.0.2
future==0.18.2
idna==2.10
importlib-metadata==2.1.1
ipaddress==1.0.23
linecache2==1.0.0
more-itertools==5.0.0
packaging==20.9
pathlib2==2.3.5
pluggy==0.13.1
publicsuffix==1.1.1
publicsuffixlist==0.7.7
py==1.10.0
pycparser==2.20
pyparsing==2.4.7
pytest==4.6.11
pytest-cov==2.11.1
requests==2.25.1
scandir==1.10.0
six==1.15.0
traceback2==1.4.0
unittest2==1.1.0
urllib3==1.26.4
validators==0.14.2
wcwidth==0.2.5
zipp==1.2.0
31 changes: 18 additions & 13 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
coverage==4.5.1
coveralls==1.5.0
domain-connect==0.0.7
pytest==3.7.4
unittest2==1.1.0
validators~=0.14.0
mock==2.0.0
requests==2.21.0
ipaddress==1.0.23; python_version < '3.3'

argparse~=1.4.0
dnspython~=1.16.0
setuptools~=40.8.0
certifi==2020.12.5
cffi==1.14.5
chardet==4.0.0
cryptography==3.3.2
decorator==4.4.2
dnspython==1.16.0
domain-connect==0.0.9
enum34==1.1.10
future==0.18.2
idna==2.10
ipaddress==1.0.23
publicsuffix==1.1.1
publicsuffixlist==0.7.7
pycparser==2.20
requests==2.25.1
six==1.15.0
urllib3==1.26.4
validators==0.14.2
15 changes: 12 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
#!/usr/bin/env python
from setuptools import setup
import dyndns

with open("README.md", "r") as fh:
long_description = fh.read()

test_deps = [
'unittest2 >= 1.1.0',
]

setup(
name = 'domain-connect-dyndns',
version = '0.0.8',
version=dyndns.__version__,
description = 'Python client library for Dynamic DNS using Domain Connect',
license = 'MIT',
long_description=long_description,
Expand All @@ -27,10 +32,14 @@
'validators >= 0.12.6',
'requests >= 2.21.0',
'dnspython >= 1.15.0',
'domain-connect >= 0.0.7',
'domain-connect >= 0.0.9',
'ipaddress >= 1.0.23;python_version<"3.3"',
],
entry_points = {
'console_scripts': ['domain-connect-dyndns=dyndns.command_line:main'],
}
},
tests_require=test_deps,
extras_require={
'test': test_deps,
},
)

0 comments on commit 136877f

Please sign in to comment.