diff --git a/docker-xmpp-notify.py b/docker-xmpp-notify.py index 376a42f..1344340 100644 --- a/docker-xmpp-notify.py +++ b/docker-xmpp-notify.py @@ -23,21 +23,22 @@ base_url = "https://hub.docker.com/v2/repositories" client = docker.from_env() + class SendMsg(sleekxmpp.ClientXMPP): - + def __init__(self, jid, password, recipient, message): sleekxmpp.ClientXMPP.__init__(self, jid, password) self.recipient = recipient self.msg = message - + self.add_event_handler("session_start", self.start, threaded=True) def start(self, event): self.send_message(mto=self.recipient, mbody=self.msg, mtype='chat') self.disconnect(wait=True) - + def get_url(base_url, image_name): name_split = split_image_name(image_name) @@ -51,7 +52,7 @@ def split_image_name(image_name): def get_user(image_name): if '/' in image_name: return image_name.split('/')[0] - + return 'library' @@ -68,7 +69,7 @@ def get_repository(image_name): def get_tag(image_name): if ':' in image_name: return image_name.split(':')[1] - + return 'latest' @@ -103,4 +104,4 @@ if message_content: xmpp = SendMsg(jid, jpassword, jto, message) if xmpp.connect(): - xmpp.process(block=True) \ No newline at end of file + xmpp.process(block=True) diff --git a/requirements.txt b/requirements.txt index cb0faf7..38e6dfc 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,10 +1,3 @@ -certifi==2017.4.17 -chardet==3.0.4 -docker==2.3.0 -docker-pycreds==0.2.1 -idna==2.5 +docker>=2.3.0,<=2.4.2 requests==2.18.1 -six==1.10.0 sleekxmpp==1.3.2 -urllib3==1.21.1 -websocket-client==0.42.1