當前位置: 首頁>>代碼示例>>Python>>正文


Python discovery.Resource方法代碼示例

本文整理匯總了Python中googleapiclient.discovery.Resource方法的典型用法代碼示例。如果您正苦於以下問題:Python discovery.Resource方法的具體用法?Python discovery.Resource怎麽用?Python discovery.Resource使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在googleapiclient.discovery的用法示例。


在下文中一共展示了discovery.Resource方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: get_conn

# 需要導入模塊: from googleapiclient import discovery [as 別名]
# 或者: from googleapiclient.discovery import Resource [as 別名]
def get_conn(self):
        """
        Creates an authenticated api client for the given api service name and credentials.

        :return: the authenticated api service.
        :rtype: Resource
        """
        self.log.info("Authenticating Google API Client")

        if not self._conn:
            http_authorized = self._authorize()
            self._conn = build(
                serviceName=self.api_service_name,
                version=self.api_version,
                http=http_authorized,
                cache_discovery=False
            )
        return self._conn 
開發者ID:apache,項目名稱:airflow,代碼行數:20,代碼來源:discovery_api.py

示例2: _build_client

# 需要導入模塊: from googleapiclient import discovery [as 別名]
# 或者: from googleapiclient.discovery import Resource [as 別名]
def _build_client(self) -> discovery.Resource:
        return self._build_arbitrary_client(self._client_name, self._client_version) 
開發者ID:nccgroup,項目名稱:ScoutSuite,代碼行數:4,代碼來源:basefacade.py

示例3: _get_client

# 需要導入模塊: from googleapiclient import discovery [as 別名]
# 或者: from googleapiclient.discovery import Resource [as 別名]
def _get_client(self) -> discovery.Resource:
        return self._build_client() 
開發者ID:nccgroup,項目名稱:ScoutSuite,代碼行數:4,代碼來源:basefacade.py

示例4: get_conn

# 需要導入模塊: from googleapiclient import discovery [as 別名]
# 或者: from googleapiclient.discovery import Resource [as 別名]
def get_conn(self) -> Resource:
        """
        Retrieves connection to DisplayVideo.
        """
        if not self._conn:
            http_authorized = self._authorize()
            self._conn = build(
                "doubleclickbidmanager",
                self.api_version,
                http=http_authorized,
                cache_discovery=False,
            )
        return self._conn 
開發者ID:apache,項目名稱:airflow,代碼行數:15,代碼來源:display_video.py

示例5: get_conn_to_display_video

# 需要導入模塊: from googleapiclient import discovery [as 別名]
# 或者: from googleapiclient.discovery import Resource [as 別名]
def get_conn_to_display_video(self) -> Resource:
        """
        Retrieves connection to DisplayVideo.
        """
        if not self._conn:
            http_authorized = self._authorize()
            self._conn = build(
                "displayvideo",
                self.api_version,
                http=http_authorized,
                cache_discovery=False,
            )
        return self._conn 
開發者ID:apache,項目名稱:airflow,代碼行數:15,代碼來源:display_video.py

示例6: _paginate

# 需要導入模塊: from googleapiclient import discovery [as 別名]
# 或者: from googleapiclient.discovery import Resource [as 別名]
def _paginate(self, resource: Resource, list_args: Optional[Dict[str, Any]] = None):
        list_args = list_args or {}
        result: List[Dict] = []
        while True:
            # start index has value 1
            request = resource.list(start_index=len(result) + 1, **list_args)  # pylint: disable=no-member
            response = request.execute(num_retries=self.num_retries)
            result.extend(response.get("items", []))
            # result is the number of fetched links from Analytics
            # when all links will be added to the result
            # the loop will break
            if response["totalResults"] <= len(result):
                break
        return result 
開發者ID:apache,項目名稱:airflow,代碼行數:16,代碼來源:analytics.py

示例7: get_conn

# 需要導入模塊: from googleapiclient import discovery [as 別名]
# 或者: from googleapiclient.discovery import Resource [as 別名]
def get_conn(self) -> Resource:
        """
        Retrieves connection to Google Analytics 360.
        """
        if not self._conn:
            http_authorized = self._authorize()
            self._conn = build(
                "analytics",
                self.api_version,
                http=http_authorized,
                cache_discovery=False,
            )
        return self._conn 
開發者ID:apache,項目名稱:airflow,代碼行數:15,代碼來源:analytics.py

示例8: get_conn

# 需要導入模塊: from googleapiclient import discovery [as 別名]
# 或者: from googleapiclient.discovery import Resource [as 別名]
def get_conn(self) -> Resource:
        """
        Retrieves connection to Campaign Manager.
        """
        if not self._conn:
            http_authorized = self._authorize()
            self._conn = build(
                "dfareporting",
                self.api_version,
                http=http_authorized,
                cache_discovery=False,
            )
        return self._conn 
開發者ID:apache,項目名稱:airflow,代碼行數:15,代碼來源:campaign_manager.py

示例9: execute

# 需要導入模塊: from googleapiclient import discovery [as 別名]
# 或者: from googleapiclient.discovery import Resource [as 別名]
def execute(self, run=True, iterate=True):
    # start building call sequence with service object
    self.function = get_service(self.api, self.version, self.auth, uri_file=self.uri)

    # build calls along stack
    # do not call functions, as the abstract is necessary for iterator page next calls
    for f_n in self.function_stack:
      #print(type(self.function), isinstance(self.function, Resource))
      self.function = getattr(self.function if isinstance(self.function, Resource) else self.function(), f_n)

    # for cases where job is handled manually, save the job
    self.job = self.function(**self.function_kwargs)

    if run:
      self.response = API_Retry(self.job)

      # if paginated, automatically iterate
      if (iterate and (self.iterate or (isinstance(self.response, dict) and 'nextPageToken' in self.response))):
        return API_Iterator(self.function, self.function_kwargs, self.response)

      # if not paginated, return object as is
      else:
        return self.response

    # if not run, just return job object ( for chunked upload for example )
    else:
      return self.job 
開發者ID:google,項目名稱:starthinker,代碼行數:29,代碼來源:__init__.py

示例10: test_mock_instantiation

# 需要導入模塊: from googleapiclient import discovery [as 別名]
# 或者: from googleapiclient.discovery import Resource [as 別名]
def test_mock_instantiation(self):
        service = SheetsService().build(http=self.http_mocks)
        assert isinstance(service, Resource) 
開發者ID:socialpoint-labs,項目名稱:sheetfu,代碼行數:5,代碼來源:test_service_mock.py

示例11: __init__

# 需要導入模塊: from googleapiclient import discovery [as 別名]
# 或者: from googleapiclient.discovery import Resource [as 別名]
def __init__(self, cloudsource_service: discovery.Resource):
        self._cloudsource_service = cloudsource_service 
開發者ID:GoogleCloudPlatform,項目名稱:django-cloud-deploy,代碼行數:4,代碼來源:cloud_source.py

示例12: __init__

# 需要導入模塊: from googleapiclient import discovery [as 別名]
# 或者: from googleapiclient.discovery import Resource [as 別名]
def __init__(self, billing_service: discovery.Resource):
        self._billing_service = billing_service 
開發者ID:GoogleCloudPlatform,項目名稱:django-cloud-deploy,代碼行數:4,代碼來源:billing.py

示例13: __init__

# 需要導入模塊: from googleapiclient import discovery [as 別名]
# 或者: from googleapiclient.discovery import Resource [as 別名]
def __init__(self, storage_service: discovery.Resource):
        self._storage_service = storage_service 
開發者ID:GoogleCloudPlatform,項目名稱:django-cloud-deploy,代碼行數:4,代碼來源:storage.py

示例14: __init__

# 需要導入模塊: from googleapiclient import discovery [as 別名]
# 或者: from googleapiclient.discovery import Resource [as 別名]
def __init__(self, sqladmin_service: discovery.Resource):
        self._sqladmin_service = sqladmin_service 
開發者ID:GoogleCloudPlatform,項目名稱:django-cloud-deploy,代碼行數:4,代碼來源:database.py

示例15: __init__

# 需要導入模塊: from googleapiclient import discovery [as 別名]
# 或者: from googleapiclient.discovery import Resource [as 別名]
def __init__(self, service_usage_service: discovery.Resource):
        self._service_usage_service = service_usage_service 
開發者ID:GoogleCloudPlatform,項目名稱:django-cloud-deploy,代碼行數:4,代碼來源:enable_service.py


注:本文中的googleapiclient.discovery.Resource方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。