本文整理汇总了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)
示例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')
示例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)
示例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)
示例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)
示例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)
示例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 = {}
示例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)
示例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
示例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)
示例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
示例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()
示例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
示例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
示例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()