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


Python HTTPChannel.dataReceived方法代码示例

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


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

示例1: YaybuChannel

# 需要导入模块: from twisted.web.http import HTTPChannel [as 别名]
# 或者: from twisted.web.http.HTTPChannel import dataReceived [as 别名]
class YaybuChannel(channel.SSHChannel):

    name = 'session'

    def __init__(self, task):
        channel.SSHChannel.__init__(self)
        self.protocol = HTTPChannel()
        self.protocol.requestFactory = self.request_factory
        self.protocol.transport = self
        self.disconnecting = False
        self.task = task

    def request_factory(self):
        return YaybuRequest(self.task)

    def openFailed(self, reason):
        print 'echo failed', reason

    def channelOpen(self, ignoredData):
        self.data = ''
        d = self.conn.sendRequest(self, 'exec', common.NS('yaybu --remote -'), wantReply = 1)
        #d.addCallback(self._cbRequest)

    def _cbRequest(self, ignored):
        #self.write('hello conch\n')
        #self.conn.sendEOF(self)
        pass

    def dataReceived(self, data):
        self.protocol.dataReceived(data)

    def closed(self):
        self.loseConnection()
        reactor.stop()
开发者ID:isotoma,项目名称:boiler,代码行数:36,代码来源:deploy.py

示例2: dataReceived

# 需要导入模块: from twisted.web.http import HTTPChannel [as 别名]
# 或者: from twisted.web.http.HTTPChannel import dataReceived [as 别名]
    def dataReceived(self, data):
        if data.startswith("<policy-file-request/>"):

            policy = (
                '<?xml version="1.0"?><!DOCTYPE cross-domain-policy SYSTEM '
                '"http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">'
                '<cross-domain-policy><allow-access-from domain="*" '
                'to-ports="*" /></cross-domain-policy>')
            self.transport.write(policy)
            self.transport.loseConnection()
        else:
            return HTTPChannel.dataReceived(self, data)
开发者ID:kowalski,项目名称:txWebSocket,代码行数:14,代码来源:websocket.py


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