diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 33df169..8771b38 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -45,4 +45,8 @@ https://codereview.stackexchange.com/questions/254272/dynamic-dns-ip-checker-cha - Consistent exit codes - Clear logs after 100 lines (keep the last 10 lines) - Try/except for permissions (instead of if/else) -- Other bugfixes/refactoring \ No newline at end of file +- Other bugfixes/refactoring + +0.1.6 (02/03/2020) +------------------ +- Fixed twitchy email notification bug \ No newline at end of file diff --git a/dist/domains-api-0.1.5.2.tar.gz b/dist/domains-api-0.1.5.2.tar.gz deleted file mode 100644 index f1e3f5b..0000000 Binary files a/dist/domains-api-0.1.5.2.tar.gz and /dev/null differ diff --git a/dist/domains-api-0.1.6.tar.gz b/dist/domains-api-0.1.6.tar.gz new file mode 100644 index 0000000..893d5af Binary files /dev/null and b/dist/domains-api-0.1.6.tar.gz differ diff --git a/domains_api/__init__.py b/domains_api/__init__.py index 9b3f11e..2231bee 100644 --- a/domains_api/__init__.py +++ b/domains_api/__init__.py @@ -66,10 +66,10 @@ def send_notification(self, ip=None, msg_type='success', error=None, outbox_msg= msg = EmailMessage() msg['From'] = self.gmail_address msg['To'] = self.gmail_address - if ip and msg_type == 'success' and self.notifications not in {'n', 'e'}: + if ip and msg_type == 'success' and self.notifications != 'e': msg.set_content(f'IP for {self.domain} has changed! New IP: {ip}') msg['Subject'] = 'IP CHANGED!' - elif msg_type == 'error' and self.notifications != 'n': + elif msg_type == 'error': msg.set_content(f"Error with {self.domain}'s IPChanger: ({error})!") msg['Subject'] = 'IPCHANGER ERROR!' elif outbox_msg: @@ -130,12 +130,13 @@ def __init__(self, argv=None): try: if self.user.previous_ip == self.current_ip: log_msg = 'Current IP: %s (no change)' % self.user.previous_ip + fh.log(log_msg, 'debug') else: self.user.previous_ip = self.current_ip fh.save_user(self.user) self.domains_api_call() log_msg = 'Newly recorded IP: %s' % self.user.previous_ip - fh.log(log_msg, 'info') + fh.log(log_msg, 'info') except AttributeError: setattr(self.user, 'previous_ip', self.current_ip) fh.save_user(self.user) @@ -174,8 +175,10 @@ def domains_api_call(self): # Successful request: _response = response.split(' ') - if 'good' in _response or 'nochg' in _response: + if 'good' in _response: self.user.send_notification(self.current_ip) + elif 'nochg' in _response: + return # Unsuccessful requests: elif response in {'nohost', 'notfqdn'}: @@ -198,6 +201,7 @@ def domains_api_call(self): fh.delete_user() fh.log('API authentication failed, user profile deleted', 'warning') sys.exit(1) + # Local connection related errors except (ConnectionError, ReqConError) as e: log_msg = 'Connection Error: %s' % e diff --git a/setup.py b/setup.py index fb5210d..39f66e1 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ setup( name='domains-api', - version='0.1.5.2', + version='0.1.6', description='Auto-updates your dynamic dns rules on Google Domains (domains.google.com)', long_description=open('README.md').read() + '\n\n' + open('CHANGELOG.txt').read(), long_description_content_type='text/markdown',