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


Python DummyRequest.__init__方法代码示例

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


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

示例1: __init__

# 需要导入模块: from twisted.web.test.test_web import DummyRequest [as 别名]
# 或者: from twisted.web.test.test_web.DummyRequest import __init__ [as 别名]
    def __init__(self, postpath, params, session=None):
        self.content = StringIO()
        self.content.write(urllib.urlencode(params))
        self.content.seek(0, 0)
        self.requestHeaders = Headers()

        DummyRequest.__init__(self, postpath, session)
开发者ID:nicholasamorim,项目名称:mamba,代码行数:9,代码来源:test_controller.py

示例2: __init__

# 需要导入模块: from twisted.web.test.test_web import DummyRequest [as 别名]
# 或者: from twisted.web.test.test_web.DummyRequest import __init__ [as 别名]
 def __init__(self, postpath, params):
     DummyRequest.__init__(self, postpath, None)
     self.content = StringIO()
     self.content.write(json.dumps(params))
     self.content.seek(0, 0)
     self.requestHeaders = Headers()
     self.method = 'POST'
     self.requestHeaders.addRawHeader('content-type', 'application/json')
开发者ID:DamnWidget,项目名称:BlackMamba,代码行数:10,代码来源:test_controller_contact.py

示例3: __init__

# 需要导入模块: from twisted.web.test.test_web import DummyRequest [as 别名]
# 或者: from twisted.web.test.test_web.DummyRequest import __init__ [as 别名]
    def __init__(self, method, url, args=None):
        DummyRequest.__init__(self, url.split('/'))
        self.method = method

        # set args
        args = args or {}
        for k, v in args.items():
            self.addArg(k, v)
开发者ID:AVert,项目名称:jasmin,代码行数:10,代码来源:twisted_web_test_utils.py

示例4: __init__

# 需要导入模块: from twisted.web.test.test_web import DummyRequest [as 别名]
# 或者: from twisted.web.test.test_web.DummyRequest import __init__ [as 别名]
 def __init__(self, method, url, args=None, headers=None):
     DummyRequest.__init__(self, url.split('/'))
     self.uri    = url
     self.method = method
     self.headers.update(headers or {})
     
     # set args
     args = args or {}
     for k, v in args.items():
         self.addArg(k, v)
开发者ID:DevMaurice,项目名称:moringa-demo,代码行数:12,代码来源:twisted_web_test_utils.py

示例5: __init__

# 需要导入模块: from twisted.web.test.test_web import DummyRequest [as 别名]
# 或者: from twisted.web.test.test_web.DummyRequest import __init__ [as 别名]
 def __init__(self, method, url, args=None, headers=None, body=None):
     DummyRequest.__init__(self, url.split('/'))
     if body is not None:
         self.content = _FakeContent(body)
     self.method = method
     self.headers.update(headers or {})
                                                                                                                                                                                    
     args = args or {}
     for k, v in args.items():
         self.addArg(k, v)
开发者ID:pgk,项目名称:mamba,代码行数:12,代码来源:helpers.py

示例6: __init__

# 需要导入模块: from twisted.web.test.test_web import DummyRequest [as 别名]
# 或者: from twisted.web.test.test_web.DummyRequest import __init__ [as 别名]
 def __init__(self, method, url, project="test", data=None, args=None, headers=None):
     DummyRequest.__init__(self, url.split("/"))
     if data is not None:
         self.content = StringIO(data)
     if project is not None:
         self.project = project
     self.method = method
     self.headers.update(headers or {})
     # set args
     args = args or {}
     for k, v in args.items():
         self.addArg(k, v)
开发者ID:DamianZhou,项目名称:portia,代码行数:14,代码来源:utils.py

示例7: __init__

# 需要导入模块: from twisted.web.test.test_web import DummyRequest [as 别名]
# 或者: from twisted.web.test.test_web.DummyRequest import __init__ [as 别名]
	def __init__(self, *args, **kwargs):
		_TwistedDummyRequest.__init__(self, *args, **kwargs)

		self.startedWriting = False
		self._disconnected = False

		# This is needed because _BaseHTTPTransport does
		#     self.request.channel.transport.setTcpNoDelay(True)
		self.channel = DummyChannel()

		self.requestHeaders = http_headers.Headers()
		self.received_cookies = {}
开发者ID:ludios,项目名称:Webmagic,代码行数:14,代码来源:fakes.py

示例8: __init__

# 需要导入模块: from twisted.web.test.test_web import DummyRequest [as 别名]
# 或者: from twisted.web.test.test_web.DummyRequest import __init__ [as 别名]
    def __init__(self, method, url, args=None, headers=None, body=None):
        DummyRequest.__init__(self, url.split('/'))
        self.method = method
        self.path =url
        self.headers.update(headers or {})
        self.content = StringIO()
    	self.content.write(body or '')
        self.content.seek(0)
 
        # set args                                                                                                                                                                                       
        args = args or {}
        for k, v in args.items():
            self.addArg(k, v)
开发者ID:dustinlacewell,项目名称:creepy,代码行数:15,代码来源:tests.py

示例9: __init__

# 需要导入模块: from twisted.web.test.test_web import DummyRequest [as 别名]
# 或者: from twisted.web.test.test_web.DummyRequest import __init__ [as 别名]
    def __init__(self, method, url, args=None, json_data=None, headers=None):
        DummyRequest.__init__(self, url.split('/'))
        self.method = method
        self.requestHeaders = http_headers.Headers(headers or {})

        # set args
        args = args or {}
        for k, v in args.items():
            self.addArg(k, v)

        if json_data is not None:
            self.content = StringIO.StringIO(json.dumps(json_data))
        else:
            self.content = None
开发者ID:jookies,项目名称:jasmin,代码行数:16,代码来源:twisted_web_test_utils.py

示例10: __init__

# 需要导入模块: from twisted.web.test.test_web import DummyRequest [as 别名]
# 或者: from twisted.web.test.test_web.DummyRequest import __init__ [as 别名]
    def __init__(self, method, url, project='test', data=None, args=None,
                 headers=None, ajax=False):
        DummyRequest.__init__(self, url.split('/'))
        if data is not None:
            self.content = StringIO(data)
        if project is not None:
            self.project = project
        self.method = method
        self.headers.update(headers or {})
        self.auth_info = {"username": "testuser", "staff": True}
        self._is_ajax = ajax
        self.requestHeaders = Headers({'user-agent': ["DummyRequester/1.0, khtml like gecko, chrome, chromium, safari, IE, webkit, etc..."]})

        # set args
        args = args or {}
        for k, v in args.items():
            self.addArg(k, v)
开发者ID:9birds,项目名称:portia,代码行数:19,代码来源:utils.py

示例11: __init__

# 需要导入模块: from twisted.web.test.test_web import DummyRequest [as 别名]
# 或者: from twisted.web.test.test_web.DummyRequest import __init__ [as 别名]
 def __init__(self, postpath, content='', headers={}, session=None):
     DummyRequest.__init__(self, postpath, session=session)
     self.content = content
     self.headers = headers
开发者ID:jwitrick,项目名称:ssl-generator-api,代码行数:6,代码来源:test_caauthorities.py

示例12: __init__

# 需要导入模块: from twisted.web.test.test_web import DummyRequest [as 别名]
# 或者: from twisted.web.test.test_web.DummyRequest import __init__ [as 别名]
 def __init__(self, method, *args, **kwargs):
     DummyRequest.__init__(self, *args, **kwargs)
     self.method = method
     self.content = StringIO()
     self.transport = StringTransport()
开发者ID:DesertBus,项目名称:sockjs-twisted,代码行数:7,代码来源:common.py

示例13: __init__

# 需要导入模块: from twisted.web.test.test_web import DummyRequest [as 别名]
# 或者: from twisted.web.test.test_web.DummyRequest import __init__ [as 别名]
 def __init__(self, path):
     DummyRequest.__init__(self, path)
     self.content = None
     self.code = None
开发者ID:pedrovereza,项目名称:pixelated-user-agent,代码行数:6,代码来源:test_helper.py

示例14: __init__

# 需要导入模块: from twisted.web.test.test_web import DummyRequest [as 别名]
# 或者: from twisted.web.test.test_web.DummyRequest import __init__ [as 别名]
 def __init__(self, *args, **kw):
     DummyRequest.__init__(self, *args, **kw)
     self.content = self
开发者ID:veliaho,项目名称:diablo,代码行数:5,代码来源:test_resource.py

示例15: __init__

# 需要导入模块: from twisted.web.test.test_web import DummyRequest [as 别名]
# 或者: from twisted.web.test.test_web.DummyRequest import __init__ [as 别名]
 def __init__(self):
     DummyRequest.__init__(self, [''])
     self.requestHeaders = DummyHTTPHeaders()
开发者ID:richiela,项目名称:Bitcoin-Poker-Room,代码行数:5,代码来源:test_apiserver.py


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