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

Method _id_to_header

googleapiclient/http.py:1279–1296  ·  view source on GitHub ↗

Convert an id to a Content-ID header value. Args: id_: string, identifier of individual request. Returns: A Content-ID header with the id_ encoded into it. A UUID is prepended to the value because Content-ID headers are supposed to be universally

(self, id_)

Source from the content-addressed store, hash-verified

1277 _auth.apply_credentials(creds, request.headers)
1278
1279 def _id_to_header(self, id_):
1280 """Convert an id to a Content-ID header value.
1281
1282 Args:
1283 id_: string, identifier of individual request.
1284
1285 Returns:
1286 A Content-ID header with the id_ encoded into it. A UUID is prepended to
1287 the value because Content-ID headers are supposed to be universally
1288 unique.
1289 """
1290 if self._base_id is None:
1291 self._base_id = uuid.uuid4()
1292
1293 # NB: we intentionally leave whitespace between base/id and '+', so RFC2822
1294 # line folding works properly on Python 3; see
1295 # https://github.com/googleapis/google-api-python-client/issues/164
1296 return "<%s + %s>" % (self._base_id, urllib.parse.quote(id_))
1297
1298 def _header_to_id(self, header):
1299 """Convert a Content-ID header value to an id.

Callers 2

_executeMethod · 0.95

Calls

no outgoing calls

Tested by 1