Debian Codegraph @

ibm_cloud_sdk_core/private_helpers.py

raw
1 # coding: utf-8
2
3 # Copyright 2024 IBM All Rights Reserved.
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 # from ibm_cloud_sdk_core.authenticators import Authenticator
17
18 import platform
19 from .version import __version__
20
21 SDK_NAME = 'ibm-python-sdk-core'
22
23
24 def _get_system_info() -> str:
25 return 'os.name={0} os.version={1} python.version={2}'.format(
26 platform.system(), platform.release(), platform.python_version()
27 )
28
29
30 def _build_user_agent(component: str = None) -> str:
31 sub_component = ""
32 if component is not None:
33 sub_component = '/{0}'.format(component)
34 return '{0}{1}-{2} {3}'.format(SDK_NAME, sub_component, __version__, _get_system_info())