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


Python THttpClient.THttpClient方法代码示例

本文整理汇总了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. 
开发者ID:lightstep,项目名称:lightstep-tracer-python,代码行数:23,代码来源:thrift_connection.py

示例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) 
开发者ID:census-instrumentation,项目名称:opencensus-python,代码行数:23,代码来源:__init__.py

示例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) 
开发者ID:CyberTKR,项目名称:CyberTK-Self,代码行数:11,代码来源:Talk.py

示例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 
开发者ID:CyberTKR,项目名称:CyberTK-Self,代码行数:14,代码来源:channel.py

示例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() 
开发者ID:CyberTKR,项目名称:CyberTK-Self,代码行数:14,代码来源:Poll.py

示例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 
开发者ID:arifistifik,项目名称:dpk,代码行数:13,代码来源:session.py

示例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 
开发者ID:arifistifik,项目名称:dpk,代码行数:13,代码来源:session.py

示例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 
开发者ID:arifistifik,项目名称:dpk,代码行数:13,代码来源:session.py

示例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 
开发者ID:arifistifik,项目名称:dpk,代码行数:13,代码来源:session.py

示例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 
开发者ID:arifistifik,项目名称:dpk,代码行数:13,代码来源:session.py


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