MCPcopy Index your code
hub / github.com/googleapis/google-api-python-client / Resource

Class Resource

googleapiclient/discovery.py:1402–1634  ·  view source on GitHub ↗

A class for interacting with a resource.

Source from the content-addressed store, hash-verified

1400
1401
1402class Resource(object):
1403 """A class for interacting with a resource."""
1404
1405 def __init__(
1406 self,
1407 http,
1408 baseUrl,
1409 model,
1410 requestBuilder,
1411 developerKey,
1412 resourceDesc,
1413 rootDesc,
1414 schema,
1415 universe_domain=universe.DEFAULT_UNIVERSE if HAS_UNIVERSE else "",
1416 ):
1417 """Build a Resource from the API description.
1418
1419 Args:
1420 http: httplib2.Http, Object to make http requests with.
1421 baseUrl: string, base URL for the API. All requests are relative to this
1422 URI.
1423 model: googleapiclient.Model, converts to and from the wire format.
1424 requestBuilder: class or callable that instantiates an
1425 googleapiclient.HttpRequest object.
1426 developerKey: string, key obtained from
1427 https://code.google.com/apis/console
1428 resourceDesc: object, section of deserialized discovery document that
1429 describes a resource. Note that the top level discovery document
1430 is considered a resource.
1431 rootDesc: object, the entire deserialized discovery document.
1432 schema: object, mapping of schema names to schema descriptions.
1433 universe_domain: string, the universe for the API. The default universe
1434 is "googleapis.com".
1435 """
1436 self._dynamic_attrs = []
1437
1438 self._http = http
1439 self._baseUrl = baseUrl
1440 self._model = model
1441 self._developerKey = developerKey
1442 self._requestBuilder = requestBuilder
1443 self._resourceDesc = resourceDesc
1444 self._rootDesc = rootDesc
1445 self._schema = schema
1446 self._universe_domain = universe_domain
1447 self._credentials_validated = False
1448
1449 self._set_service_methods()
1450
1451 def _set_dynamic_attr(self, attr_name, value):
1452 """Sets an instance attribute and tracks it in a list of dynamic attributes.
1453
1454 Args:
1455 attr_name: string; The name of the attribute to be set
1456 value: The value being set on the object and tracked in the dynamic cache.
1457 """
1458 self._dynamic_attrs.append(attr_name)
1459 self.__dict__[attr_name] = value

Callers 2

build_from_documentFunction · 0.85
methodResourceMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…