本文整理汇总了Python中thrift.transport.THttpClient.THttpClient方法的典型用法代码示例。如果您正苦于以下问题:Python THttpClient.THttpClient方法的具体用法?Python THttpClient.THttpClient怎么用?Python THttpClient.THttpClient使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类thrift.transport.THttpClient
的用法示例。
在下文中一共展示了THttpClient.THttpClient方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: open
# 需要导入模块: from thrift.transport import THttpClient [as 别名]
# 或者: from thrift.transport.THttpClient import THttpClient [as 别名]
def open(self):
"""Establish HTTP connection to the server.
Note: THttpClient also supports https and will use http/https according
to the scheme in the URL it is given.
"""
self._lock.acquire()
try:
self._transport = THttpClient.THttpClient(self._collector_url)
self._transport.open()
protocol = TBinaryProtocol.TBinaryProtocol(self._transport)
self._client = ReportingService.Client(protocol)
except Thrift.TException:
self._open_exceptions_count += 1
else:
self.ready = True
finally:
self._lock.release()
# May throw an Exception on failure.
示例2: __init__
# 需要导入模块: from thrift.transport import THttpClient [as 别名]
# 或者: from thrift.transport.THttpClient import THttpClient [as 别名]
def __init__(
self,
thrift_url='',
auth=None,
client=jaeger.Client,
transport=sync.SyncTransport,
http_transport=THttpClient.THttpClient):
self.transport = transport(self)
self.thrift_url = thrift_url
self.auth = auth
self.http_transport = http_transport(uri_or_host=thrift_url)
self.client = client(
iprot=TBinaryProtocol.TBinaryProtocol(trans=self.http_transport))
# set basic auth header
if auth is not None:
import base64
auth_header = '{}:{}'.format(*auth)
decoded = base64.b64encode(auth_header.encode()).decode('ascii')
basic_auth = dict(Authorization='Basic {}'.format(decoded))
self.http_transport.setCustomHeaders(basic_auth)
示例3: __init__
# 需要导入模块: from thrift.transport import THttpClient [as 别名]
# 或者: from thrift.transport.THttpClient import THttpClient [as 别名]
def __init__(self):
self.transport = THttpClient.THttpClient('https://gd2.line.naver.jp:443'+self.auth_query_path)
self.transport.setCustomHeaders({
"User-Agent" : self.UA,
"X-Line-Application" : self.LA,
})
self.transport.open()
self.protocol = TCompactProtocol.TCompactProtocol(self.transport);
self.client = LineService.Client(self.protocol)
示例4: __init__
# 需要导入模块: from thrift.transport import THttpClient [as 别名]
# 或者: from thrift.transport.THttpClient import THttpClient [as 别名]
def __init__(self, authToken):
self.authToken = authToken
self.transport = THttpClient.THttpClient('https://gd2.line.naver.jp:443'+self.http_query_path)
self.transport.setCustomHeaders({ "User-Agent" : self.UA,
"X-Line-Application" : self.LA,
"X-Line-Access": self.authToken
})
self.transport.open()
self.protocol = TCompactProtocol.TCompactProtocol(self.transport)
self.client = LineService.Client(self.protocol)
self.mid = self.client.getProfile().mid
self.transport.path = self.channel_query_path
示例5: __init__
# 需要导入模块: from thrift.transport import THttpClient [as 别名]
# 或者: from thrift.transport.THttpClient import THttpClient [as 别名]
def __init__(self, authToken):
self.transport = THttpClient.THttpClient('https://gd2.line.naver.jp:443'+ self.http_query_path)
self.transport.setCustomHeaders({
"User-Agent" : self.UA,
"X-Line-Application" : self.LA,
"X-Line-Access": authToken
});
self.protocol = TCompactProtocol.TCompactProtocol(self.transport);
self.client = LineService.Client(self.protocol)
self.rev = self.client.getLastOpRevision()
self.transport.path = self.polling_path
self.transport.open()
示例6: Auth
# 需要导入模块: from thrift.transport import THttpClient [as 别名]
# 或者: from thrift.transport.THttpClient import THttpClient [as 别名]
def Auth(self, isopen=True):
self.transport = THttpClient.THttpClient(self.host)
self.transport.setCustomHeaders(self.headers)
self.protocol = TCompactProtocol.TCompactProtocol(self.transport)
self._auth = AuthService.Client(self.protocol)
if isopen:
self.transport.open()
return self._auth
示例7: Talk
# 需要导入模块: from thrift.transport import THttpClient [as 别名]
# 或者: from thrift.transport.THttpClient import THttpClient [as 别名]
def Talk(self, isopen=True):
self.transport = THttpClient.THttpClient(self.host)
self.transport.setCustomHeaders(self.headers)
self.protocol = TCompactProtocol.TCompactProtocol(self.transport)
self._talk = TalkService.Client(self.protocol)
if isopen:
self.transport.open()
return self._talk
示例8: Channel
# 需要导入模块: from thrift.transport import THttpClient [as 别名]
# 或者: from thrift.transport.THttpClient import THttpClient [as 别名]
def Channel(self, isopen=True):
self.transport = THttpClient.THttpClient(self.host)
self.transport.setCustomHeaders(self.headers)
self.protocol = TCompactProtocol.TCompactProtocol(self.transport)
self._channel = ChannelService.Client(self.protocol)
if isopen:
self.transport.open()
return self._channel
示例9: Call
# 需要导入模块: from thrift.transport import THttpClient [as 别名]
# 或者: from thrift.transport.THttpClient import THttpClient [as 别名]
def Call(self, isopen=True):
self.transport = THttpClient.THttpClient(self.host)
self.transport.setCustomHeaders(self.headers)
self.protocol = TCompactProtocol.TCompactProtocol(self.transport)
self._call = CallService.Client(self.protocol)
if isopen:
self.transport.open()
return self._call
示例10: Square
# 需要导入模块: from thrift.transport import THttpClient [as 别名]
# 或者: from thrift.transport.THttpClient import THttpClient [as 别名]
def Square(self, isopen=True):
self.transport = THttpClient.THttpClient(self.host)
self.transport.setCustomHeaders(self.headers)
self.protocol = TCompactProtocol.TCompactProtocol(self.transport)
self._square = SquareService.Client(self.protocol)
if isopen:
self.transport.open()
return self._square