本文整理汇总了Python中twisted.web.proxy.ProxyClient.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python ProxyClient.__init__方法的具体用法?Python ProxyClient.__init__怎么用?Python ProxyClient.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类twisted.web.proxy.ProxyClient
的用法示例。
在下文中一共展示了ProxyClient.__init__方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from twisted.web.proxy import ProxyClient [as 别名]
# 或者: from twisted.web.proxy.ProxyClient import __init__ [as 别名]
def __init__(self, *args, **kwargs):
ProxyClient.__init__(self, *args, **kwargs)
self.overrides = []
self.restricted_headers = [
'accept-charset',
'accept-encoding',
'access-control-request-headers',
'access-control-request-method',
'connection',
'content-length',
'cookie',
'cookie2',
'content-transfer-encoding',
'date',
'expect',
'host',
'keep-alive',
'origin',
'referer',
'te',
'trailer',
'transfer-encoding',
'upgrade',
'user-agent',
'via'
]
self.all_headers = []
self.unsent_restricted_headers = []
示例2: __init__
# 需要导入模块: from twisted.web.proxy import ProxyClient [as 别名]
# 或者: from twisted.web.proxy.ProxyClient import __init__ [as 别名]
def __init__(self, *args, **kwargs):
self._buffer = []
self.encoding = ''
self.ctype = ''
self.reencode = True
self.replace = False
self.headers_to_cache = {}
ProxyClient.__init__(self,*args,**kwargs)
示例3: __init__
# 需要导入模块: from twisted.web.proxy import ProxyClient [as 别名]
# 或者: from twisted.web.proxy.ProxyClient import __init__ [as 别名]
def __init__(self, *args, **kwargs):
ProxyClient.__init__(self, *args, **kwargs)
self.replacing = None
self.rewriting = None
self._buf = None
cache_path = cache_file(self.father.uri)
replace_path = replace_file(self.father.uri)
if cache_path and not os.path.exists(cache_path):
t = threading.Thread(target=lambda:urllib.urlretrieve(self.father.uri, cache_path))
t.start()
if replace_path:
self.replacing = replace_path
elif 'json/Level' in self.father.uri and self.father.uri.endswith('.json'):
self.rewriting = True
self._buf = ''
示例4: __init__
# 需要导入模块: from twisted.web.proxy import ProxyClient [as 别名]
# 或者: from twisted.web.proxy.ProxyClient import __init__ [as 别名]
def __init__(self, command, rest, version, headers, data, father, resource):
father.notifyFinish().addErrback(self._clientfinished, father, resource)
if "proxy-connection" in headers:
del headers["proxy-connection"]
headers["connection"] = "close"
headers.pop('keep-alive', None)
self.headers = headers
log.debug("Proxy Client SEND headers: "+str(headers))
ProxyClient.__init__(self,
command=command,
rest=rest,
version=version,
headers=headers,
data=data,
father=father)
示例5: __init__
# 需要导入模块: from twisted.web.proxy import ProxyClient [as 别名]
# 或者: from twisted.web.proxy.ProxyClient import __init__ [as 别名]
def __init__(self, command, rest, version, headers, data, request):
"""
Override ProxyClient.__init__ to:
1. Set client HBModuleRegistry
2. Set an intercept buffer
3. Set an intercept header
4. Set transaction_id
"""
ProxyClient.__init__(self, command, rest, version, headers, data,
request)
self.module_registry = request.module_registry
self.buffer = ""
self.header = {}
now = datetime.datetime.now()
self.father.response_createdAt = now.strftime('%Y-%m-%d %H:%M:%S')
示例6: __init__
# 需要导入模块: from twisted.web.proxy import ProxyClient [as 别名]
# 或者: from twisted.web.proxy.ProxyClient import __init__ [as 别名]
def __init__(self, *args, **kwargs):
self.buf = ""
self.gziped = False
ProxyClient.__init__(self, *args, **kwargs)
示例7: __init__
# 需要导入模块: from twisted.web.proxy import ProxyClient [as 别名]
# 或者: from twisted.web.proxy.ProxyClient import __init__ [as 别名]
def __init__(self, command, rest, version, headers, data, father):
ProxyClient.__init__(self, command, rest, version, headers, data, father)
示例8: __init__
# 需要导入模块: from twisted.web.proxy import ProxyClient [as 别名]
# 或者: from twisted.web.proxy.ProxyClient import __init__ [as 别名]
def __init__(self, *args, **kwargs):
ProxyClient.__init__(self, *args, **kwargs)
self.rewrite = False
self.length = None
self.buffer = ''
示例9: __init__
# 需要导入模块: from twisted.web.proxy import ProxyClient [as 别名]
# 或者: from twisted.web.proxy.ProxyClient import __init__ [as 别名]
def __init__(self, *args, **kwargs):
ProxyClient.__init__(self, *args, **kwargs)
self.image_parser = None
示例10: __init__
# 需要导入模块: from twisted.web.proxy import ProxyClient [as 别名]
# 或者: from twisted.web.proxy.ProxyClient import __init__ [as 别名]
def __init__(self, *args, **kwargs):
ProxyClient.__init__(self, *args, **kwargs)
self.image_parser = None
self.ctype_received = False
self.clength = 0