本文整理匯總了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