当前位置: 首页>>代码示例>>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;未经允许,请勿转载。