sagemaker.core.utils.user_agent#
Functions
Get the user agent extra suffix string specific to SageMakerCore |
|
Check if the platform is SageMaker Notebook, if yes, return the InstanceType |
|
Check if the platform is SageMaker Studio, if yes, return the AppType |
|
|
Sanitize a User-Agent string component by replacing disallowed characters with '-'. |
- sagemaker.core.utils.user_agent.get_user_agent_extra_suffix() str[source]#
Get the user agent extra suffix string specific to SageMakerCore
Adhers to new boto recommended User-Agent 2.0 header format
- Returns:
The user agent extra suffix string to be appended
- Return type:
str
- sagemaker.core.utils.user_agent.process_notebook_metadata_file() str[source]#
Check if the platform is SageMaker Notebook, if yes, return the InstanceType
- Returns:
The InstanceType of the SageMaker Notebook if it exists, otherwise None
- Return type:
str
- sagemaker.core.utils.user_agent.process_studio_metadata_file() str[source]#
Check if the platform is SageMaker Studio, if yes, return the AppType
- Returns:
The AppType of the SageMaker Studio if it exists, otherwise None
- Return type:
str
- sagemaker.core.utils.user_agent.sanitize_user_agent_string_component(raw_str, allow_hash=False)[source]#
Sanitize a User-Agent string component by replacing disallowed characters with ‘-‘.
- Parameters:
raw_str (str) – The input string to sanitize.
allow_hash (bool) – Whether ‘#’ is considered an allowed character.
- Returns:
The sanitized string.
- Return type:
str