@@ -599,19 +599,32 @@ 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 command:
611
+ (Optional) Information about which interface for the operation was
612
+ used, to be included in the X-Goog-API-Client header. Please leave
613
+ as None unless otherwise directed.
614
+
615
+ :rtype: dict
616
+ :returns: The headers to be used for the request.
609
617
"""
618
+ x_goog_api_client = f"{ user_agent } { _get_invocation_id ()} "
619
+
620
+ if command :
621
+ x_goog_api_client += f" gccl-gcs-cmd/{ command } "
622
+
610
623
return {
611
624
"Accept" : "application/json" ,
612
625
"Accept-Encoding" : "gzip, deflate" ,
613
626
"User-Agent" : user_agent ,
614
- "X-Goog-API-Client" : f" { user_agent } { _get_invocation_id () } " ,
627
+ "X-Goog-API-Client" : x_goog_api_client ,
615
628
"content-type" : content_type ,
616
629
"x-upload-content-type" : x_upload_content_type or content_type ,
617
630
}
0 commit comments