minor improvements
+ add Licence * correct subprocess.call syntax * optimized imports * some path optimizations
This commit is contained in:
parent
051f450f50
commit
59954bb21b
|
@ -0,0 +1,13 @@
|
||||||
|
Copyright (c) 2019 Nico Wellpott <nico@magicbroccoli.de>
|
||||||
|
|
||||||
|
Permission to use, copy, modify, and/or distribute this software for any
|
||||||
|
purpose with or without fee is hereby granted, provided that the above
|
||||||
|
copyright notice and this permission notice appear in all copies.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
|
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
|
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||||
|
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
|
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||||
|
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
|
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
15
main.py
15
main.py
|
@ -1,13 +1,12 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# workflow
|
|
||||||
# start options main.py --dry-run --outfile file
|
|
||||||
import requests
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
import argparse
|
import argparse
|
||||||
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import sys
|
||||||
|
|
||||||
|
import requests
|
||||||
from ruamel.yaml import YAML, scalarstring
|
from ruamel.yaml import YAML, scalarstring
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,8 +23,8 @@ class BlacklistImporter:
|
||||||
"""
|
"""
|
||||||
determine if the download is required
|
determine if the download is required
|
||||||
"""
|
"""
|
||||||
etag_path = "".join([self.path, "/.etag"])
|
etag_path = "/".join([self.path, ".etag"])
|
||||||
blacklist_path = "".join([self.path, "/blacklist.txt"])
|
blacklist_path = "/".join([self.path, "blacklist.txt"])
|
||||||
|
|
||||||
# check if etag header is present if not set local_etag to ""
|
# check if etag header is present if not set local_etag to ""
|
||||||
if os.path.isfile(etag_path):
|
if os.path.isfile(etag_path):
|
||||||
|
@ -77,7 +76,7 @@ class BlacklistImporter:
|
||||||
|
|
||||||
# reload config if changes have been applied
|
# reload config if changes have been applied
|
||||||
if self.change:
|
if self.change:
|
||||||
subprocess.call('/usr/sbin/ejabberdctl reload_config', shell=False)
|
subprocess.call(['/usr/sbin/ejabberdctl', 'reload_config'], shell=False)
|
||||||
|
|
||||||
def process(self):
|
def process(self):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue