You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: google/cloud/storage/_helpers.py
+16-5Lines changed: 16 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -599,19 +599,30 @@ def _get_default_headers(
599
599
user_agent,
600
600
content_type="application/json; charset=UTF-8",
601
601
x_upload_content_type=None,
602
+
command=None,
602
603
):
603
604
"""Get the headers for a request.
604
605
605
-
Args:
606
-
user_agent (str): The user-agent for requests.
607
-
Returns:
608
-
Dict: The headers to be used for the request.
606
+
:type user_agent: str
607
+
:param user_agent: The user-agent for requests.
608
+
609
+
:type command: str
610
+
:param user_agent:
611
+
(Optional) Information about which interface for upload/download was used, to be included in the X-Goog-API-Client header for traffic analysis purposes. Please leave as None unless otherwise directed.
:param content_type: Type of content being uploaded (or :data:`None`).
1711
1711
1712
+
:type command: str
1713
+
:param command:
1714
+
(Optional) Information about which interface for upload was used, to be included in the X-Goog-API-Client header for traffic analysis purposes. Please leave as None unless otherwise directed.
(google.cloud.storage.retry) for information on retry types and how
1823
1830
to configure them.
1824
1831
1832
+
:type command: str
1833
+
:param command:
1834
+
(Optional) Information about which interface for upload was used, to be included in the X-Goog-API-Client header for traffic analysis purposes. Please leave as None unless otherwise directed.
1835
+
1825
1836
:rtype: :class:`~requests.Response`
1826
1837
:returns: The "200 OK" response object returned after the multipart
(google.cloud.storage.retry) for information on retry types and how
2009
2021
to configure them.
2010
2022
2023
+
:type command: str
2024
+
:param command:
2025
+
(Optional) Information about which interface for upload was used, to be included in the X-Goog-API-Client header for traffic analysis purposes. Please leave as None unless otherwise directed.
(google.cloud.storage.retry) for information on retry types and how
2192
2209
to configure them.
2193
2210
2211
+
:type command: str
2212
+
:param command:
2213
+
(Optional) Information about which interface for upload was used, to be included in the X-Goog-API-Client header for traffic analysis purposes. Please leave as None unless otherwise directed.
2214
+
2194
2215
:rtype: :class:`~requests.Response`
2195
2216
:returns: The "200 OK" response object returned after the final chunk
2196
2217
is uploaded.
@@ -2209,6 +2230,7 @@ def _do_resumable_upload(
2209
2230
timeout=timeout,
2210
2231
checksum=checksum,
2211
2232
retry=retry,
2233
+
command=command,
2212
2234
)
2213
2235
whilenotupload.finished:
2214
2236
try:
@@ -2234,6 +2256,7 @@ def _do_upload(
2234
2256
timeout=_DEFAULT_TIMEOUT,
2235
2257
checksum=None,
2236
2258
retry=None,
2259
+
command=None,
2237
2260
):
2238
2261
"""Determine an upload strategy and then perform the upload.
2239
2262
@@ -2333,6 +2356,10 @@ def _do_upload(
2333
2356
configuration changes for Retry objects such as delays and deadlines
2334
2357
are respected.
2335
2358
2359
+
:type command: str
2360
+
:param command:
2361
+
(Optional) Information about which interface for upload was used, to be included in the X-Goog-API-Client header for traffic analysis purposes. Please leave as None unless otherwise directed.
2362
+
2336
2363
:rtype: dict
2337
2364
:returns: The parsed JSON from the "200 OK" response. This will be the
2338
2365
**only** response in the multipart case and it will be the
@@ -2366,6 +2393,7 @@ def _do_upload(
2366
2393
timeout=timeout,
2367
2394
checksum=checksum,
2368
2395
retry=retry,
2396
+
command=command,
2369
2397
)
2370
2398
else:
2371
2399
response=self._do_resumable_upload(
@@ -2382,6 +2410,7 @@ def _do_upload(
2382
2410
timeout=timeout,
2383
2411
checksum=checksum,
2384
2412
retry=retry,
2413
+
command=command,
2385
2414
)
2386
2415
2387
2416
returnresponse.json()
@@ -2402,6 +2431,7 @@ def _prep_and_do_upload(
2402
2431
timeout=_DEFAULT_TIMEOUT,
2403
2432
checksum=None,
2404
2433
retry=DEFAULT_RETRY_IF_GENERATION_SPECIFIED,
2434
+
command=None,
2405
2435
):
2406
2436
"""Upload the contents of this blob from a file-like object.
2407
2437
@@ -2522,6 +2552,10 @@ def _prep_and_do_upload(
2522
2552
configuration changes for Retry objects such as delays and deadlines
2523
2553
are respected.
2524
2554
2555
+
:type command: str
2556
+
:param command:
2557
+
(Optional) Information about which interface for upload was used, to be included in the X-Goog-API-Client header for traffic analysis purposes. Please leave as None unless otherwise directed.
"""Download the contents of a blob object into a file-like object.
4113
4149
@@ -4195,6 +4231,10 @@ def _prep_and_do_download(
4195
4231
predicates in a Retry object. The default will always be used. Other
4196
4232
configuration changes for Retry objects such as delays and deadlines
4197
4233
are respected.
4234
+
4235
+
:type command: str
4236
+
:param command:
4237
+
(Optional) Information about which interface for download was used, to be included in the X-Goog-API-Client header for traffic analysis purposes. Please leave as None unless otherwise directed.
0 commit comments