当前位置: 首页>>代码示例>>Python>>正文


Python zeroless.Client类代码示例

本文整理汇总了Python中zeroless.Client的典型用法代码示例。如果您正苦于以下问题:Python Client类的具体用法?Python Client怎么用?Python Client使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Client类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_data_is_not_bytes

    def test_data_is_not_bytes(self):
        client = Client()
        client.connect_local(port=7050)
        push = client.push()

        with pytest.raises(TypeError):
            push(u'msg')
开发者ID:davinirjr,项目名称:zeroless,代码行数:7,代码来源:test_exceptions.py

示例2: test_client_addresses_property

    def test_client_addresses_property(self):
        client = Client()
        addresses = (('10.0.0.1', 1567), ('10.0.0.2', 1568), ('10.0.0.3', 1569))

        for ip, port in addresses:
            client.connect(ip, port)

        assert client.addresses == addresses
开发者ID:jkhoogland,项目名称:python-zeroless,代码行数:8,代码来源:test_client_server.py

示例3: test_port_under_range

    def test_port_under_range(self):
        client = Client()
        with pytest.raises(ValueError):
           client.connect_local(port=1023)

        with pytest.raises(ValueError):
           client.disconnect_local(port=1023)

        with pytest.raises(ValueError):
            Server(port=1023)
开发者ID:davinirjr,项目名称:zeroless,代码行数:10,代码来源:test_exceptions.py

示例4: test_connection_already_exist

    def test_connection_already_exist(self):
        client = Client()
        client.connect_local(port=1024)

        with pytest.raises(ValueError):
            client.connect_local(port=1024)

        client.disconnect_local(port=1024)
        client.connect_local(port=1024)
开发者ID:davinirjr,项目名称:zeroless,代码行数:9,代码来源:test_exceptions.py

示例5: test_connection_after_pattern_was_established

    def test_connection_after_pattern_was_established(self):
        client = Client()
        listen_for_push = client.pull()

        client.connect_local(port=1024)

        with pytest.raises(ValueError):
            client.connect_local(port=1024)

        client.disconnect_local(port=1024)

        with pytest.raises(ValueError):
            client.disconnect_local(port=1024)
开发者ID:davinirjr,项目名称:zeroless,代码行数:13,代码来源:test_exceptions.py

示例6: test_subscribed_topics_are_not_bytes

    def test_subscribed_topics_are_not_bytes(self):
        client = Client()
        client.connect_local(port=7099)

        client.sub(topics=[b'topic1'])

        with pytest.raises(TypeError):
            client.sub(topics=[u'topic1'])

        with pytest.raises(TypeError):
            client.sub(topics=[b'topic1', u'topic2'])
开发者ID:davinirjr,项目名称:zeroless,代码行数:11,代码来源:test_exceptions.py

示例7: test_there_was_no_connection_to_disconnect

    def test_there_was_no_connection_to_disconnect(self):
        client = Client()
        client.connect_local(port=1024)

        with pytest.raises(ValueError):
            client.disconnect_local(port=1025)

        client.disconnect_local(port=1024)

        with pytest.raises(ValueError):
            client.disconnect_local(port=1024)
开发者ID:davinirjr,项目名称:zeroless,代码行数:11,代码来源:test_exceptions.py

示例8: test_port_on_range

 def test_port_on_range(self):
     client = Client()
     client.connect_local(port=1024)
     client.disconnect_local(port=1024)
     client.connect_local(port=7000)
     client.disconnect_local(port=7000)
     client.connect_local(port=65535)
     client.disconnect_local(port=65535)
开发者ID:davinirjr,项目名称:zeroless,代码行数:8,代码来源:test_exceptions.py

示例9: test_pair_client_cannot_connect_more_than_once

    def test_pair_client_cannot_connect_more_than_once(self):
        client = Client()
        client.connect_local(port=7200)
        client.connect_local(port=7201)

        with pytest.raises(RuntimeError):
            client.pair()

        client = Client()
        client.connect_local(port=7200)

        client.pair()

        with pytest.raises(RuntimeError):
            client.connect_local(port=7201)
开发者ID:davinirjr,项目名称:zeroless,代码行数:15,代码来源:test_exceptions.py

示例10: import

import logging

from zeroless import (Client, log)

# Setup console logging
consoleHandler = logging.StreamHandler()
log.setLevel(logging.DEBUG)
log.addHandler(consoleHandler)

# Connects the client to as many servers as desired
client = Client()
client.connect_local(port=12345)

# Initiate a push client
# And assigns a callable to push messages
push = client.push()

for msg in [b"Msg1", b"Msg2", b"Msg3"]:
    push(msg)
开发者ID:EnTeQuAk,项目名称:python-zeroless,代码行数:19,代码来源:pushPullClient.py

示例11: import

from zeroless import (Client, Server)
import json
from aura.managers import SemanticManager as graph
from aura.managers import StorageManager as db
from aura.managers import helpers

zmq_device = Client()
zmq_device.connect_local(port=helpers.ports['device_manager'])
push_to_device = zmq_device.push()

def create_condition(condition):
    print("create_condition")
    # TaskManager -> StorageManager
    db.store('conditions', condition)


def update_condition():
    # TaskManager -> StorageManager
    print("update_condition")


def remove_condition():
    # TaskManager -> StorageManager
    print("remove_condition")


def send_command(device, command):
    # TaskManager -> DeviceManager
    print("send_command")

开发者ID:AuraMiddleware,项目名称:aura-middleware,代码行数:29,代码来源:TaskManager.py

示例12: listen_for_pub_with_empty_topic

def listen_for_pub_with_empty_topic():
    client = Client()
    client.connect_local(port=7896)
    return client.sub()
开发者ID:jkhoogland,项目名称:python-zeroless,代码行数:4,代码来源:test_pubsub.py

示例13: import

import logging

from zeroless import (Client, log)

# Setup console logging
consoleHandler = logging.StreamHandler()
log.setLevel(logging.DEBUG)
log.addHandler(consoleHandler)

# Connects the client to as many servers as desired
client = Client()
client.connect_local(port=12345)

# Initiate a subscriber client
# Assigns an iterable to wait for incoming messages with the topic 'sh'
listen_for_pub = client.sub(topics=[b'sh'])

for topic, msg in listen_for_pub:
    print(topic, ' - ', msg)
开发者ID:davinirjr,项目名称:zeroless,代码行数:19,代码来源:pubSubServer.py

示例14: import

import logging

from zeroless import (Client, log)

# Setup console logging
consoleHandler = logging.StreamHandler()
log.setLevel(logging.DEBUG)
log.addHandler(consoleHandler)

# Connects the client to a single server
client = Client()
client.connect_local(port=12345)

# Initiate a pair client
# And assigns a callable and an iterable
# To both transmit and wait for incoming messages
pair, listen_for_pair = client.pair()

for msg in [b"Msg1", b"Msg2", b"Msg3"]:
    pair(msg)
    response = next(listen_for_pair)
    print(response)
开发者ID:EnTeQuAk,项目名称:python-zeroless,代码行数:22,代码来源:pairClient.py

示例15: pair

def pair():
    client = Client()
    client.connect_local(port=7890)
    send, _ = client.pair()
    return send
开发者ID:EnTeQuAk,项目名称:python-zeroless,代码行数:5,代码来源:test_pair.py


注:本文中的zeroless.Client类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。