コード例 #1
0
ファイル: __init__.py プロジェクト: eeknay/cube_python
    def __init__(self, cs):
        o = urlparse(cs)

        if o.scheme == "udp":
            self.sub = UDPEmitter(o.hostname, o.port)

        if o.scheme == "ws":
            self.sub = WSEmitter(o.hostname, o.port, o.path)
コード例 #2
0
ファイル: __init__.py プロジェクト: eeknay/cube_python
    def __init__(self, cs):
        o = urlparse(cs)

        if o.scheme == 'udp':
            self.sub = UDPEmitter(o.hostname, o.port)

        if o.scheme == 'ws':
            self.sub = WSEmitter(o.hostname, o.port, o.path)
コード例 #3
0
ファイル: __init__.py プロジェクト: eeknay/cube_python
class Emitter:
    def __init__(self, cs):
        o = urlparse(cs)

        if o.scheme == 'udp':
            self.sub = UDPEmitter(o.hostname, o.port)

        if o.scheme == 'ws':
            self.sub = WSEmitter(o.hostname, o.port, o.path)

        # TODO: http

    # Very simple interface,
    def send(self, obj):
        obj['time'] = datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%SZ")
        return self.sub.send(json.dumps(obj))

    def close(self):
        return self.sub.close()
コード例 #4
0
ファイル: __init__.py プロジェクト: eeknay/cube_python
class Emitter:
    def __init__(self, cs):
        o = urlparse(cs)

        if o.scheme == "udp":
            self.sub = UDPEmitter(o.hostname, o.port)

        if o.scheme == "ws":
            self.sub = WSEmitter(o.hostname, o.port, o.path)

            # TODO: http

            # Very simple interface,

    def send(self, obj):
        obj["time"] = datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%SZ")
        return self.sub.send(json.dumps(obj))

    def close(self):
        return self.sub.close()