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

Method _build_query

googleapiclient/model.py:184–205  ·  view source on GitHub ↗

Builds a query string. Args: params: dict, the query parameters Returns: The query parameters properly encoded into an HTTP URI query string.

(self, params)

Source from the content-addressed store, hash-verified

182 return (headers, path_params, query, body_value)
183
184 def _build_query(self, params):
185 """Builds a query string.
186
187 Args:
188 params: dict, the query parameters
189
190 Returns:
191 The query parameters properly encoded into an HTTP URI query string.
192 """
193 if self.alt_param is not None:
194 params.update({"alt": self.alt_param})
195 astuples = []
196 for key, value in params.items():
197 if type(value) == type([]):
198 for x in value:
199 x = x.encode("utf-8")
200 astuples.append((key, x))
201 else:
202 if isinstance(value, str) and callable(value.encode):
203 value = value.encode("utf-8")
204 astuples.append((key, value))
205 return "?" + urllib.parse.urlencode(astuples)
206
207 def _log_response(self, resp, content):
208 """Logs debugging information about the response if requested."""

Callers 2

requestMethod · 0.95
test_build_queryMethod · 0.95

Calls 1

updateMethod · 0.80

Tested by 1

test_build_queryMethod · 0.76