Skip to content

Commit

Permalink
Merge pull request #5 from Domain-Connect/bugfix/issues/4
Browse files Browse the repository at this point in the history
BUGFIX: issues/4 error when setting up .app domain
  • Loading branch information
pawel-kow authored Oct 29, 2019
2 parents 23f91c7 + 2e67f78 commit b2b3b2d
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 13 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,5 +145,6 @@ dc = DomainConnect(
## CHANGELOG
| version | date | changes |
| ------- | -----------| ------ |
| 0.0.7 | 2019-10-29 | Bugfix: error when setting up .app domain |
| 0.0.6 | 2019-07-05 | UPDATE: moved from pycrypto to cryptography (due to know security issues) |
| 0.0.5 | 2019-03-12 | NEW FEATURE: url signing capability added |
4 changes: 2 additions & 2 deletions domainconnect/domainconnect.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from six.moves import urllib
from dns.exception import Timeout
from dns.resolver import Resolver, NXDOMAIN, YXDOMAIN, NoAnswer, NoNameservers
from publicsuffix import PublicSuffixList
from publicsuffixlist import PublicSuffixList
import webbrowser
from .network import get_json, get_http, http_request_json, NetworkContext

Expand Down Expand Up @@ -195,7 +195,7 @@ def __init__(self, networkcontext=NetworkContext()):

@staticmethod
def identify_domain_root(domain):
return psl.get_public_suffix(domain)
return psl.privatesuffix(domain)

def _identify_domain_connect_api(self, domain_root):
# noinspection PyBroadException
Expand Down
38 changes: 38 additions & 0 deletions domainconnect/tests/test_domainConnect.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,44 @@ def _test_get_domain_config(config):
assert (res.urlAPI == config['API_URL']), 'urlAPI not correct: {}'.format(res.urlAPI)
assert (res.providerName == config['PROVIDER_ID']), 'providerName not correct: {}'.format(res.providerName)

domainroottests = [
('test.com', 'test.com', ''),
('subdomain.test.com', 'test.com', 'subdomain'),
('sub.subdomain.test.com', 'test.com', 'sub.subdomain'),
('test.co.uk', 'test.co.uk', ''),
('subdomain.test.co.uk', 'test.co.uk', 'subdomain'),
('sub.subdomain.test.co.uk', 'test.co.uk', 'sub.subdomain'),
('test.uk', 'test.uk', ''),
('subdomain.test.uk', 'test.uk', 'subdomain'),
('sub.subdomain.test.uk', 'test.uk', 'sub.subdomain'),
('test.com.de', 'test.com.de', ''),
('subdomain.test.com.de', 'test.com.de', 'subdomain'),
('sub.subdomain.test.com.de', 'test.com.de', 'sub.subdomain'),
('test.poznan.pl', 'test.poznan.pl', ''),
('subdomain.test.poznan.pl', 'test.poznan.pl', 'subdomain'),
('sub.subdomain.test.poznan.pl', 'test.poznan.pl', 'sub.subdomain'),
('get.app', 'get.app', ''),
('subdomain.get.app', 'get.app', 'subdomain'),
('sub.subdomain.get.app', 'get.app', 'sub.subdomain'),
('get.unkownnewtld', 'get.unkownnewtld', ''),
('subdomain.get.unkownnewtld', 'get.unkownnewtld', 'subdomain'),
('sub.subdomain.get.unkownnewtld', 'get.unkownnewtld', 'sub.subdomain'),
]

def test_get_domain_root(self):
for i in TestDomainConnect.domainroottests:
with self.subTest(i=i):
self._test_get_domain_root(i)

@staticmethod
def _test_get_domain_root(config):
dc = DomainConnect()
domain_root = dc.identify_domain_root(config[0]);
assert domain_root is not None, "No domain root found"
assert domain_root == config[1], "Wrong domain root found. Expected {}, Found {}".format(config[1], domain_root)
assert '{}{}{}'.format(config[2], '' if config[2] == '' else '.', domain_root) == config[0], "Domain root + subdomain != domain"


def test_get_domain_connect_template_async_url(self):
for i in configs:
with self.subTest(i=i):
Expand Down
10 changes: 5 additions & 5 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
asn1crypto==0.24.0
cffi==1.12.3
cryptography==2.7
asn1crypto==1.2.0
cffi==1.13.1
cryptography==2.8
dnspython==1.16.0
future==0.17.1
future==0.18.1
linecache2==1.0.0
publicsuffix==1.1.0
publicsuffixlist==0.6.5
publicsuffixlist==0.6.11
pybase64==0.5.0
pycparser==2.19
six==1.12.0
Expand Down
12 changes: 6 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from setuptools import setup

setup(name='domain_connect',
version='0.0.6',
version='0.0.7',
description='Python client library for Domain Connect protocol. See: https://domainconnect.org',
long_description_content_type="text/markdown",
long_description=open('README.md').read(),
Expand All @@ -19,11 +19,11 @@
'domainconnect',
],
install_requires=[
'dnspython >= 1.15.0',
'dnspython >= 1.16.0',
'publicsuffix >= 1.1.0',
'publicsuffixlist >= 0.6.1',
'six >= 1.11.0',
'future >= 0.16.0',
'cryptography >= 2.7'
'publicsuffixlist >= 0.6.11',
'six >= 1.12.0',
'future >= 0.18.1',
'cryptography >= 2.8'
],
)

0 comments on commit b2b3b2d

Please sign in to comment.