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


Python Sender.send方法代码示例

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


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

示例1: OnActionStart

# 需要导入模块: from sender import Sender [as 别名]
# 或者: from sender.Sender import send [as 别名]
    def OnActionStart(self, event):
        handler = rt.RichTextHTMLHandler()
        handler.SetFlags(rt.RICHTEXT_HANDLER_SAVE_IMAGES_TO_BASE64)
        handler.SetFontSizeMapping([7,9,11,12,14,22,100])

        import cStringIO
        stream = cStringIO.StringIO()
        if not handler.SaveStream(self.richTextPanel.rtc.GetBuffer(), stream):
            return
        htmldata = stream.getvalue()
        text = content.mime_message(htmldata, "hello hello this is a test", "this is a test", "[email protected]",
                       "[email protected]").as_string()

        with open('email-example.eml', 'w') as f:
            f.write(text)
        #start send

        listctrl = self.list_ctrl
        _count = listctrl.GetItemCount()
        _host = config.read_config(config.HOST)
        _port = config.read_config(config.PORT)
        _user = config.read_config(config.ACCOUNT_NAME)
        _password = config.read_config(config.PASSWORD)
        _from = config.read_config(config.FROM)
        sender = Sender(_host, _port)
        sender.login(_user, _password)
        for i in range(_count):
            sender.send(_from, listctrl.GetItem(i, 1).GetText(), text)
开发者ID:patrickwai,项目名称:PyMail,代码行数:30,代码来源:main.py

示例2: __send_broadcast_frame

# 需要导入模块: from sender import Sender [as 别名]
# 或者: from sender.Sender import send [as 别名]
 def __send_broadcast_frame(self, frame):
     """
     Method that send broadcast frame if possible or push the frame to the queue of all Workers.
     This is necessary because we are not able to identify ACK frames because of the missing sequence number on WiWo
     frames.
     """
     if self.__are_workers_available_for_broadcast_frame():
         self.__set_workers_to_wait_response(frame)
         Sender.send(frame, self.__iface_name)
     else:
         time.sleep(1)  # TODO: Fix this code, it's not clear.
         if self.__are_workers_available_for_broadcast_frame():
             self.__set_workers_to_wait_response(frame)
             Sender.send(frame, self.__iface_name)
开发者ID:azizjonm,项目名称:wiwo,代码行数:16,代码来源:manager_svc.py

示例3: _send

# 需要导入模块: from sender import Sender [as 别名]
# 或者: from sender.Sender import send [as 别名]
 def _send(self, frame, iface_name):
     self.__communication_status = Worker.COMMUNICATION_WAITING
     self.__last_frame_sent = frame
     frame = Sender.send(frame, iface_name)
     log_line = "- [SENT]: %s" % repr(frame)
     self.__frame_log.append(log_line)
     return frame
开发者ID:azizjonm,项目名称:wiwo,代码行数:9,代码来源:worker.py

示例4: submit

# 需要导入模块: from sender import Sender [as 别名]
# 或者: from sender.Sender import send [as 别名]
def submit(d):
    header = Header(d["method"], d["path"], d["httpversion"])
    for i in d['headers']:
        header.add_header(i['header_name'], i['header_value'])
    header.build_from_text()
    print(header.payload)
    s = Sender()
    r = Response()
    resp = r.input_text(s.send(d["protocol"], d["hostname"], header.payload))
    return resp
开发者ID:gorillanet,项目名称:httpTester,代码行数:12,代码来源:main.py

示例5: __init__

# 需要导入模块: from sender import Sender [as 别名]
# 或者: from sender.Sender import send [as 别名]
class Connection:

    def __init__(self, packet_sender):
        print 'Init Connection'

        self.ee = EventEmitter()

        self._sender = Sender(packet_sender)
        self._receiver = Receiver(packet_sender)

        @self._receiver.ee.on('data')
        def on_data(data):
            self.ee.emit('data', data)

    def send(self, data):
        self._sender.send(data)

    def receive(self, packet):
        if packet.getIsAcknowledgement():
            self._sender.verifyAcknowledgement(packet.getSequenceNumber())
        else:
            self._receiver.receive(packet)
开发者ID:hoffmabc,项目名称:python-rudp,代码行数:24,代码来源:connection.py

示例6: len

# 需要导入模块: from sender import Sender [as 别名]
# 或者: from sender.Sender import send [as 别名]
    log_name = config["rule_generator"]["parameters"]["file_name"]
    try:
        rule_list = generator.create_from_file(log_name)
        number_of_rules = len(rule_list)
    except FileNotFoundError:
        print("Can not find file " + log_name)
        exit()
else:
    number_of_rules = config["rule_generator"]["parameters"]["number_of_rules"]
times = []


time_str = time.strftime("%Y%m%d-%H%M%S")
with open('./rules_log/' + time_str + '.txt', 'w') as log_file:
    for i in range(number_of_rules):
        startTime = time.time()
        rule = rule_list[i] if from_file else generator.create_rule()
        add_ins, add_del = sender.send(rule)
        installed_counter += add_ins
        deleted_counter += add_del
        times.append(time.time() - startTime)
        log_file.write(str(rule) + '\n')
        print("Rule #" + str(i + 1))
        pp.pprint(rule)

print(str(installed_counter) + " of " + str(number_of_rules) + \
      " rules was successfully installed and " + str(deleted_counter) + " was deleted")
print(about_times(times))
plot_time_per_rule(times)

开发者ID:AndreyNoskov,项目名称:rule_generator,代码行数:31,代码来源:main.py

示例7: Main

# 需要导入模块: from sender import Sender [as 别名]
# 或者: from sender.Sender import send [as 别名]
class Main(QMainWindow):
    def __init__(self):
        QMainWindow.__init__(self)

        # make variables
        self.voltage = 0
        self.current = 0

        # load gui.ui
        self.ui = loadUi('../gui/gui.ui')

        self.ui.setAttribute(QtCore.Qt.WA_DeleteOnClose, True)
        self.ui.destroyed.connect(self.shutdown)

        # show window
        self.ui.show()

        # make new log object
        self.log = Log(self.ui)

        # make new sender object
        self.sender = Sender(self.ui, self.log)

        # set events
        self.set_events()

        # initial reset
        self.sender.reset()

        # new listener
        self.listener = Listener()

        # new_data_received signal
        self.listener.data_received.connect(self.new_data_received)

        # start listener
        self.listener.start()

        # new interpreter
        self.interpreter = Interpreter(self.log, self.ui)

        # add tree
        self.add_tree()

    def add_tree(self):
        # Items for tree
        voltage_item = QTreeWidgetItem(["Spannung", str(self.voltage) + " V"])
        self.ui.treeView.addTopLevelItem(voltage_item)

        current_item = QTreeWidgetItem(["Strom", str(self.current) + " A"])
        self.ui.treeView.addTopLevelItem(current_item)

        power_item = QTreeWidgetItem(["Watt", "0 W"])
        self.ui.treeView.addTopLevelItem(power_item)

    def set_events(self):
        # sendButton clicked
        self.ui.sendButton.clicked.connect(lambda: self.sender.send("debug"))

        # holdButton clicked
        self.ui.holdButton.clicked.connect(self.log.toggle_hold)

        # clearButton clicked
        self.ui.clearButton.clicked.connect(self.log.clear_log)

        # messageInput return pressed
        self.ui.messageInput.returnPressed.connect(lambda: self.sender.send("debug"))

        # sliders value changed
        self.ui.voltageSlider.sliderReleased.connect(lambda: self.sender.send("slider-voltage"))
        self.ui.currentSlider.sliderReleased.connect(lambda: self.sender.send("slider-current"))

        # reset action
        self.ui.resetActionButton.triggered.connect(self.sender.reset)

        # automode checkbox
        self.ui.automodeCheckbox.stateChanged.connect(lambda: self.sender.send("checkbox-automode"))

        # lamp checkboxes
        self.ui.lamp1Checkbox.stateChanged.connect(lambda: self.sender.send("checkbox-lamp"))
        self.ui.lamp2Checkbox.stateChanged.connect(lambda: self.sender.send("checkbox-lamp"))
        self.ui.lamp3Checkbox.stateChanged.connect(lambda: self.sender.send("checkbox-lamp"))
        self.ui.lamp4Checkbox.stateChanged.connect(lambda: self.sender.send("checkbox-lamp"))

    def new_data_received(self, text):
        self.interpreter.interpret(text)

    def shutdown(self):
        self.listener.exit()
开发者ID:spaibs,项目名称:eCARus-IT,代码行数:91,代码来源:main.py

示例8: len

# 需要导入模块: from sender import Sender [as 别名]
# 或者: from sender.Sender import send [as 别名]
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
description
1. send message from wechat account to employee which watch this wechat account
"""
from sender import Sender
import sys


if __name__ == '__main__':
    if len(sys.argv) < 2:
        print "usage : python weixin_sender.py text_to_send. "
        exit()

    sender = Sender()
    sender.send(str(sys.argv[1]))
开发者ID:zmoon111,项目名称:my_monitor,代码行数:20,代码来源:weixin_sender.py

示例9: list

# 需要导入模块: from sender import Sender [as 别名]
# 或者: from sender.Sender import send [as 别名]
    """Shuffle a list and verify that it is not the same."""
    old_seq = list(seq)
    while seq == old_seq:
        shuffle(seq)
    return seq

with open('participants.txt') as f:
    participants = [
        tuple(line.strip().split('|')) for line in f.readlines()
        if line != '\n'
    ]

shuffle_and_verify(participants)

client = Sender(args.server, args.email, args.password)
client.login()

f = open('matches.txt', 'w')

for i in range(len(participants)):
    giver = participants[i]
    getter = participants[(i + 1) % len(participants)]
    f.write(giver[0] + ' --> ' + getter[0] + '\n')
    client.send(
        giver[1], 'Secret Santa',
        'Your match is: %s' % getter[0]
    )

f.close()
client.logout()
开发者ID:chrisdusovic,项目名称:secret-santa,代码行数:32,代码来源:secret_santa.py


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