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


Python http.Request类代码示例

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


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

示例1: connectionLost

 def connectionLost(self, reason):
     """
     Cleans up reply channel on close.
     """
     if self.reply_channel:
         del self.channel.factory.reply_protocols[self.reply_channel]
     Request.connectionLost(self, reason)
开发者ID:ydaniv,项目名称:channels,代码行数:7,代码来源:http_twisted.py

示例2: __init__

 def __init__(self, channel, queued, reactor=reactor):
     Request.__init__(self, channel, queued)
     self.reactor       = reactor
     self.urlMonitor    = URLMonitor.getInstance()
     self.cookieCleaner = CookieCleaner.getInstance()
     self.dnsCache      = DnsCache.getInstance()
     self.plugins       = ProxyPlugins.getInstance()
开发者ID:djgrasss,项目名称:MITMf,代码行数:7,代码来源:ClientRequestHSTS.py

示例3: test_handle_request_method_raise_delugeerror

    def test_handle_request_method_raise_delugeerror(self):
        json = JSON()

        def get_session_id(s_id):
            return s_id
        self.patch(deluge.ui.web.auth, 'get_session_id', get_session_id)
        auth_conf = {'session_timeout': 10, 'sessions': {}}
        auth = Auth(auth_conf)
        request = Request(MagicMock(), False)
        request.base = ''
        auth._create_session(request)
        methods = yield json.get_remote_methods()
        # Verify the function has been registered
        self.assertTrue('testclass.test' in methods)

        request = MagicMock()
        request.getCookie = MagicMock(return_value=list(auth.config['sessions'])[0])
        json_data = {'method': 'testclass.test', 'id': 0, 'params': []}
        request.json = json_lib.dumps(json_data)
        request_id, result, error = json._handle_request(request)
        result.addCallback(self.fail)

        def on_error(error):
            self.assertEqual(error.type, DelugeError)
        result.addErrback(on_error)
        yield result
开发者ID:deluge-torrent,项目名称:deluge,代码行数:26,代码来源:test_json_api.py

示例4: __init__

    def __init__(self, channel, queued, reactor = reactor):
        Request.__init__(self, channel, queued)

        logging.debug('Client request initiated...')

        self.reactor = reactor
        self.url_monitor = URLMonitor.get_instance()
        self.cookie_cleaner = CookieCleaner.get_instance()
        self.dns_cache = DNSCache.get_instance()
开发者ID:Tijme,项目名称:tsslstrip,代码行数:9,代码来源:ClientRequest.py

示例5: __init__

	def __init__(self, channel, queued, reactor=reactor):
		Request.__init__(self, channel, queued)
		self.reactor = reactor
		self.peers = {}
		self.protocol = None
		self.host = None
		self.port = None
		self.rest = None
		self.configs = reactor.configs
		self.log = Logger()
开发者ID:doctorOb,项目名称:MQP,代码行数:10,代码来源:BaseProxy.py

示例6: requestReceived

    def requestReceived(self, command, path, version):
        Request.requestReceived(self, command, path, version)

        p = self.channel

        source = self.channel.transport.getPeer()
        destination = self.channel.transport.getHost()
        client_id = (source.host, source.port)
        p.nflogServer.logClient.logHTTP(client_id, destination.host,
                destination.port, self.getRequestHostname(), path)
开发者ID:alessandrod,项目名称:cattivo,代码行数:10,代码来源:logger.py

示例7: __init__

 def __init__(self, channel, queued, reactor=reactor):
     Request.__init__(self, channel, queued)
     self.reactor       = reactor
     self.urlMonitor    = URLMonitor.getInstance()
     self.hsts          = URLMonitor.getInstance().hsts
     self.cookieCleaner = CookieCleaner.getInstance()
     self.dnsCache      = DnsCache.getInstance()
     #self.uniqueId      = random.randint(0, 10000)
     
     #Use are own DNS server instead of reactor.resolve()
     self.customResolver = dns.resolver.Resolver()    
     self.customResolver.nameservers  = ['127.0.0.1']
开发者ID:Gajasurve,项目名称:MITMf,代码行数:12,代码来源:ClientRequest.py

示例8: serverResponse

 def serverResponse(self, message):
     """
     Writes a received HTTP response back out to the transport.
     """
     # Write code
     self.setResponseCode(message['status'])
     # Write headers
     for header, value in message.get("headers", {}):
         self.setHeader(header.encode("utf8"), value.encode("utf8"))
     # Write cookies
     for cookie in message.get("cookies"):
         self.cookies.append(cookie.encode("utf8"))
     # Write out body
     if "content" in message:
         Request.write(self, message['content'].encode("utf8"))
     self.finish()
开发者ID:ydaniv,项目名称:channels,代码行数:16,代码来源:http_twisted.py

示例9: __init__

    def __init__(self, channel, path):
        """
        @param channel: the channel we're connected to.
        @param path: URI path
        """
        Request.__init__(self, channel, queued=False)

        # Unlike http.Request, which waits until it's received the whole request to set uri, args,
        # and path, we must do this ASAP
        self.uri = path
        x = self.uri.split('?', 1)

        if len(x) == 1:
            self.path = self.uri
            self.args = {}
        else:
            self.path, argstring = x
            self.args = parse_qs(argstring, 1)
开发者ID:ajdavis,项目名称:SyncSend,代码行数:18,代码来源:upload.py

示例10: __init__

	def __init__(self, channel, queued, reactor=reactor):
		Request.__init__(self, channel, queued)
		self.reactor	   = reactor
		self.urlMonitor	= URLMonitor.getInstance()
		self.dnsCache	  = DnsCache.getInstance()
开发者ID:Churro,项目名称:clipcaptcha,代码行数:5,代码来源:ClientRequest.py

示例11: test_get_request_content_from_args

 def test_get_request_content_from_args(self):
     req = Request(None, True)
     req.args = {'input': ['bar']}
     self.assertEqual(self.transport.get_request_content(req), 'bar')
开发者ID:AndrewCvekl,项目名称:vumi,代码行数:4,代码来源:test_mxit.py

示例12: __init__

 def __init__(self, *a, **kw):
     self.yay = kw.pop('yay')
     Request.__init__(self, *a, **kw)
开发者ID:pombredanne,项目名称:boiler,代码行数:3,代码来源:deploy.py

示例13: __init__

 def __init__(self, channel, queued, reactor=reactor):
     Request.__init__(self, channel, queued)
     self.reactor       	     = reactor
     self.PersistentData      = PersistentData.getInstance()
开发者ID:Kharlam,项目名称:Lupin,代码行数:4,代码来源:ClientRequest.py

示例14: __init__

 def __init__(self, channel, queued=_QUEUED_SENTINEL, reactor=reactor):
     Request.__init__(self, channel, queued)
     self.reactor = reactor
开发者ID:JohnDoes95,项目名称:project_parser,代码行数:3,代码来源:proxy.py

示例15: __init__

 def __init__(self, *args, **kwargs):
     self.key = KEYFILE
     self.cert = CERTFILE
     self.opener = urllib2.build_opener(HTTPSClientCertHandler(self.key, self.cert))
     Request.__init__(self, *args, **kwargs)
开发者ID:nookieman,项目名称:ClientCertHTTPProxy,代码行数:5,代码来源:clientCertHTTPProxy.py


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