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


Python AppAssertionCredentials.authorize方法代码示例

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


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

示例1: GcpHubClient

# 需要导入模块: from oauth2client.contrib.gce import AppAssertionCredentials [as 别名]
# 或者: from oauth2client.contrib.gce.AppAssertionCredentials import authorize [as 别名]

#.........这里部分代码省略.........
    self._new_updates.set()  # Wake up the transmission thread.

    if self._main_thread is not None:
      self._main_thread.join()
      self._main_thread = None

    if self._transmission_thread is not None:
      self._transmission_thread.join()
      self._transmission_thread = None

  def EnqueueBreakpointUpdate(self, breakpoint):
    """Asynchronously updates the specified breakpoint on the backend.

    This function returns immediately. The worker thread is actually doing
    all the work. The worker thread is responsible to retry the transmission
    in case of transient errors.

    Args:
      breakpoint: breakpoint in either final or non-final state.
    """
    with self._transmission_thread_startup_lock:
      if self._transmission_thread is None:
        self._transmission_thread = threading.Thread(
            target=self._TransmissionThreadProc)
        self._transmission_thread.name = 'Cloud Debugger transmission thread'
        self._transmission_thread.daemon = True
        self._transmission_thread.start()

    self._transmission_queue.append((breakpoint, 0))
    self._new_updates.set()  # Wake up the worker thread to send immediately.

  def _BuildService(self):
    http = httplib2.Http(timeout=_HTTP_TIMEOUT_SECONDS)
    http = self._credentials.authorize(http)

    api = apiclient.discovery.build('clouddebugger', 'v2', http=http)
    return api.controller()

  def _MainThreadProc(self):
    """Entry point for the worker thread."""
    registration_required = True
    while not self._shutdown:
      if registration_required:
        service = self._BuildService()
        registration_required, delay = self._RegisterDebuggee(service)

      if not registration_required:
        registration_required, delay = self._ListActiveBreakpoints(service)

      if self.on_idle is not None:
        self.on_idle()

      if not self._shutdown:
        time.sleep(delay)

  def _TransmissionThreadProc(self):
    """Entry point for the transmission worker thread."""
    reconnect = True

    while not self._shutdown:
      self._new_updates.clear()

      if reconnect:
        service = self._BuildService()
        reconnect = False
开发者ID:GoogleCloudPlatform,项目名称:cloud-debug-python,代码行数:69,代码来源:gcp_hub_client.py


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