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


Python Client.push方法代码示例

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


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

示例1: test_data_is_not_bytes

# 需要导入模块: from zeroless import Client [as 别名]
# 或者: from zeroless.Client import push [as 别名]
    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,代码行数:9,代码来源:test_exceptions.py

示例2: push

# 需要导入模块: from zeroless import Client [as 别名]
# 或者: from zeroless.Client import push [as 别名]
def push():
    client = Client()
    client.connect_local(port=7891)
    return client.push()
开发者ID:EnTeQuAk,项目名称:python-zeroless,代码行数:6,代码来源:test_pushpull.py

示例3: import

# 需要导入模块: from zeroless import Client [as 别名]
# 或者: from zeroless.Client import push [as 别名]
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,代码行数:21,代码来源:pushPullClient.py

示例4: import

# 需要导入模块: from zeroless import Client [as 别名]
# 或者: from zeroless.Client import push [as 别名]
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,代码行数:31,代码来源:TaskManager.py

示例5: Client

# 需要导入模块: from zeroless import Client [as 别名]
# 或者: from zeroless.Client import push [as 别名]
from aura.managers import StorageManager as db
from aura.managers import SemanticManager as graph
from zeroless import Client, Server
from aura.managers import helpers
import json

zmq_broker = Client()
zmq_broker.connect_local(port=helpers.ports["broker"])
push_to_broker = zmq_broker.push()

zmq_task = Client()
zmq_task.connect_local(port=helpers.ports["task_manager"])
push_to_task = zmq_task.push()


def verify(collection, obj_id):
    return db.get(collection, obj_id) != None


def create(collection, obj):
    if not verify(collection, obj["@id"]):
        graph.parse(json.dumps(obj))
        db.store(collection, obj)
    else:
        print("Already have " + str(obj["@id"]) + " in database.")


def notify_unknown_object(obj_type, obj_id):
    obj = {}
    obj["id"] = obj_id
    obj["type"] = obj_type
开发者ID:AuraMiddleware,项目名称:aura-middleware,代码行数:33,代码来源:DeviceManager.py

示例6: int

# 需要导入模块: from zeroless import Client [as 别名]
# 或者: from zeroless.Client import push [as 别名]
#!/usr/bin/env python3

from os import environ
import paho.mqtt.client as mqtt
from aura.managers import helpers
from zeroless import Client, Server


mqtt_broker_ip = environ['MQTT_BROKER_IP']
mqtt_port = int(environ['MQTT_PORT'])

zmq_client = Client()
zmq_client.connect_local(port=helpers.ports['device_manager'])
zmq_push = zmq_client.push()

def on_connect(client, userdata, flags, rc):
    print("Connected with result code "+str(rc))
    client.subscribe("gateways/test")


def on_message(client, userdata, msg):
    zmq_push(msg.payload)


client = mqtt.Client()
client.on_connect = on_connect
client.on_message = on_message

client.connect(mqtt_broker_ip, mqtt_port, 60)

#Listen for gateways' MQTT messages
开发者ID:AuraMiddleware,项目名称:aura-middleware,代码行数:33,代码来源:aura_broker.py


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