summaryrefslogtreecommitdiff
path: root/ausbutler/goniec.py
blob: b25ded21c2e62bcccc315609046e9c69cf95325e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import socket

from .tour_config import Constants


class Goniec(object):
    def __init__(self, config):
        self.config = config

    def send(self, files):
        if self.config['enabled']:
            try:
                content_lines = [Constants.path] + files + ['bye', '']
                goniec = socket.socket()
                goniec.connect((self.config['host'], self.config['port']))
                goniec.sendall('\n'.join(content_lines))
                goniec.close()
            except socket.error:
                print 'WARNING: unable to send files via Goniec'