Skip to content

Commit b2b3b2d

Browse files
authored
Merge pull request #5 from Domain-Connect/bugfix/issues/4
BUGFIX: issues/4 error when setting up .app domain
2 parents 23f91c7 + 2e67f78 commit b2b3b2d

File tree

5 files changed

+52
-13
lines changed

5 files changed

+52
-13
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,5 +145,6 @@ dc = DomainConnect(
145145
## CHANGELOG
146146
| version | date | changes |
147147
| ------- | -----------| ------ |
148+
| 0.0.7 | 2019-10-29 | Bugfix: error when setting up .app domain |
148149
| 0.0.6 | 2019-07-05 | UPDATE: moved from pycrypto to cryptography (due to know security issues) |
149150
| 0.0.5 | 2019-03-12 | NEW FEATURE: url signing capability added |

domainconnect/domainconnect.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from six.moves import urllib
1414
from dns.exception import Timeout
1515
from dns.resolver import Resolver, NXDOMAIN, YXDOMAIN, NoAnswer, NoNameservers
16-
from publicsuffix import PublicSuffixList
16+
from publicsuffixlist import PublicSuffixList
1717
import webbrowser
1818
from .network import get_json, get_http, http_request_json, NetworkContext
1919

@@ -195,7 +195,7 @@ def __init__(self, networkcontext=NetworkContext()):
195195

196196
@staticmethod
197197
def identify_domain_root(domain):
198-
return psl.get_public_suffix(domain)
198+
return psl.privatesuffix(domain)
199199

200200
def _identify_domain_connect_api(self, domain_root):
201201
# noinspection PyBroadException

domainconnect/tests/test_domainConnect.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,44 @@ def _test_get_domain_config(config):
185185
assert (res.urlAPI == config['API_URL']), 'urlAPI not correct: {}'.format(res.urlAPI)
186186
assert (res.providerName == config['PROVIDER_ID']), 'providerName not correct: {}'.format(res.providerName)
187187

188+
domainroottests = [
189+
('test.com', 'test.com', ''),
190+
('subdomain.test.com', 'test.com', 'subdomain'),
191+
('sub.subdomain.test.com', 'test.com', 'sub.subdomain'),
192+
('test.co.uk', 'test.co.uk', ''),
193+
('subdomain.test.co.uk', 'test.co.uk', 'subdomain'),
194+
('sub.subdomain.test.co.uk', 'test.co.uk', 'sub.subdomain'),
195+
('test.uk', 'test.uk', ''),
196+
('subdomain.test.uk', 'test.uk', 'subdomain'),
197+
('sub.subdomain.test.uk', 'test.uk', 'sub.subdomain'),
198+
('test.com.de', 'test.com.de', ''),
199+
('subdomain.test.com.de', 'test.com.de', 'subdomain'),
200+
('sub.subdomain.test.com.de', 'test.com.de', 'sub.subdomain'),
201+
('test.poznan.pl', 'test.poznan.pl', ''),
202+
('subdomain.test.poznan.pl', 'test.poznan.pl', 'subdomain'),
203+
('sub.subdomain.test.poznan.pl', 'test.poznan.pl', 'sub.subdomain'),
204+
('get.app', 'get.app', ''),
205+
('subdomain.get.app', 'get.app', 'subdomain'),
206+
('sub.subdomain.get.app', 'get.app', 'sub.subdomain'),
207+
('get.unkownnewtld', 'get.unkownnewtld', ''),
208+
('subdomain.get.unkownnewtld', 'get.unkownnewtld', 'subdomain'),
209+
('sub.subdomain.get.unkownnewtld', 'get.unkownnewtld', 'sub.subdomain'),
210+
]
211+
212+
def test_get_domain_root(self):
213+
for i in TestDomainConnect.domainroottests:
214+
with self.subTest(i=i):
215+
self._test_get_domain_root(i)
216+
217+
@staticmethod
218+
def _test_get_domain_root(config):
219+
dc = DomainConnect()
220+
domain_root = dc.identify_domain_root(config[0]);
221+
assert domain_root is not None, "No domain root found"
222+
assert domain_root == config[1], "Wrong domain root found. Expected {}, Found {}".format(config[1], domain_root)
223+
assert '{}{}{}'.format(config[2], '' if config[2] == '' else '.', domain_root) == config[0], "Domain root + subdomain != domain"
224+
225+
188226
def test_get_domain_connect_template_async_url(self):
189227
for i in configs:
190228
with self.subTest(i=i):

requirements.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
asn1crypto==0.24.0
2-
cffi==1.12.3
3-
cryptography==2.7
1+
asn1crypto==1.2.0
2+
cffi==1.13.1
3+
cryptography==2.8
44
dnspython==1.16.0
5-
future==0.17.1
5+
future==0.18.1
66
linecache2==1.0.0
77
publicsuffix==1.1.0
8-
publicsuffixlist==0.6.5
8+
publicsuffixlist==0.6.11
99
pybase64==0.5.0
1010
pycparser==2.19
1111
six==1.12.0

setup.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from setuptools import setup
44

55
setup(name='domain_connect',
6-
version='0.0.6',
6+
version='0.0.7',
77
description='Python client library for Domain Connect protocol. See: https://domainconnect.org',
88
long_description_content_type="text/markdown",
99
long_description=open('README.md').read(),
@@ -19,11 +19,11 @@
1919
'domainconnect',
2020
],
2121
install_requires=[
22-
'dnspython >= 1.15.0',
22+
'dnspython >= 1.16.0',
2323
'publicsuffix >= 1.1.0',
24-
'publicsuffixlist >= 0.6.1',
25-
'six >= 1.11.0',
26-
'future >= 0.16.0',
27-
'cryptography >= 2.7'
24+
'publicsuffixlist >= 0.6.11',
25+
'six >= 1.12.0',
26+
'future >= 0.18.1',
27+
'cryptography >= 2.8'
2828
],
2929
)

0 commit comments

Comments
 (0)