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

Class BaseModel

googleapiclient/model.py:97–264  ·  view source on GitHub ↗

Base model class. Subclasses should provide implementations for the "serialize" and "deserialize" methods, as well as values for the following class attributes. Attributes: accept: The value to use for the HTTP Accept header. content_type: The value to use for the HTTP Cont

Source from the content-addressed store, hash-verified

95
96
97class BaseModel(Model):
98 """Base model class.
99
100 Subclasses should provide implementations for the "serialize" and
101 "deserialize" methods, as well as values for the following class attributes.
102
103 Attributes:
104 accept: The value to use for the HTTP Accept header.
105 content_type: The value to use for the HTTP Content-type header.
106 no_content_response: The value to return when deserializing a 204 "No
107 Content" response.
108 alt_param: The value to supply as the "alt" query parameter for requests.
109 """
110
111 accept = None
112 content_type = None
113 no_content_response = None
114 alt_param = None
115
116 def _log_request(self, headers, path_params, query, body):
117 """Logs debugging information about the request if requested."""
118 if dump_request_response:
119 LOGGER.info("--request-start--")
120 LOGGER.info("-headers-start-")
121 for h, v in headers.items():
122 LOGGER.info("%s: %s", h, v)
123 LOGGER.info("-headers-end-")
124 LOGGER.info("-path-parameters-start-")
125 for h, v in path_params.items():
126 LOGGER.info("%s: %s", h, v)
127 LOGGER.info("-path-parameters-end-")
128 LOGGER.info("body: %s", body)
129 LOGGER.info("query: %s", query)
130 LOGGER.info("--request-end--")
131
132 def request(self, headers, path_params, query_params, body_value, api_version=None):
133 """Updates outgoing requests with a serialized body.
134
135 Args:
136 headers: dict, request headers
137 path_params: dict, parameters that appear in the request path
138 query_params: dict, parameters that appear in the query
139 body_value: object, the request body as a Python object, which must be
140 serializable by json.
141 api_version: str, The precise API version represented by this request,
142 which will result in an API Version header being sent along with the
143 HTTP request.
144 Returns:
145 A tuple of (headers, path_params, query, body)
146
147 headers: dict, request headers
148 path_params: dict, parameters that appear in the request path
149 query: string, query part of the request URI
150 body: string, the body serialized as JSON
151 """
152 query = self._build_query(query_params)
153 headers["accept"] = self.accept
154 headers["accept-encoding"] = "gzip, deflate"

Callers 1

test_build_queryMethod · 0.90

Calls

no outgoing calls

Tested by 1

test_build_queryMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…