diff --git a/socketsecurity/__init__.py b/socketsecurity/__init__.py index 117c489..75fd0ec 100644 --- a/socketsecurity/__init__.py +++ b/socketsecurity/__init__.py @@ -1,3 +1,6 @@ __author__ = 'socket.dev' __version__ = '2.10.9' -USER_AGENT = f'SocketPythonCLI/{__version__}' +# The name Socket's API attributes this client by. Callers that build their +# own User-Agent read it from here, so a rename lands in one place. +USER_AGENT_NAME = 'socket-python-cli' +USER_AGENT = f'{USER_AGENT_NAME}/{__version__}' diff --git a/socketsecurity/socketcli.py b/socketsecurity/socketcli.py index 704f1fc..1962037 100644 --- a/socketsecurity/socketcli.py +++ b/socketsecurity/socketcli.py @@ -12,6 +12,7 @@ from socketdev import socketdev from socketdev.fullscans import FullScanParams +from socketsecurity import USER_AGENT_NAME from socketsecurity.config import CliConfig, truncate_commit_message from socketsecurity.core import Core from socketsecurity.core.classes import Diff @@ -240,7 +241,7 @@ def apply_git_context(config: CliConfig) -> Tuple[bool, Optional[Git]]: def build_socket_sdk(config: CliConfig) -> socketdev: - cli_user_agent_string = f"SocketPythonCLI/{config.version}" + cli_user_agent_string = f"{USER_AGENT_NAME}/{config.version}" return socketdev( token=config.api_token, timeout=get_api_request_timeout(config),