summaryrefslogtreecommitdiffstats
path: root/utils/log_picker/sending/senderbaseclass.py
blob: 30aec026d4de92c1bc027c5a91b3d0ea1bf49fce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import datetime
from socket import gethostname


class SenderError(Exception):
    pass


class SenderBaseClass(object):
    
    def __init__(self, *args, **kwargs):
        pass
    
    def sendfile(self, filename, contenttype):
        raise NotImplementedError()
    
    def _get_description(self, prefix=""):
        try:
            hostname = gethostname()
        except:
            hostname = ""
        date_str = datetime.datetime.now().strftime("%Y-%m-%d")
        description = "%s (%s) %s" % (prefix, hostname, date_str)
        return description