Skip to content

Commit a4cc539

Browse files
committed
feat(user-agent): rename the client to socket-python-cli
Socket's public APIs read the User-Agent to attribute a request, and every other Socket client names itself in lowercase-hyphen form. The camel-case name was the odd one out. The name lived as a literal in two places, so a rename could half-apply. Both now read USER_AGENT_NAME from socketsecurity/__init__.py. depscan accepts SocketPythonCLI/ and socket-python-cli/ both, so attribution carries across the rename with no gap. Nothing breaks if this ships before or after that change.
1 parent dfbcee5 commit a4cc539

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

‎socketsecurity/__init__.py‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
__author__ = 'socket.dev'
22
__version__ = '2.10.9'
3-
USER_AGENT = f'SocketPythonCLI/{__version__}'
3+
# The name Socket's API attributes this client by. Callers that build their
4+
# own User-Agent read it from here, so a rename lands in one place.
5+
USER_AGENT_NAME = 'socket-python-cli'
6+
USER_AGENT = f'{USER_AGENT_NAME}/{__version__}'

‎socketsecurity/socketcli.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from socketdev import socketdev
1313
from socketdev.fullscans import FullScanParams
1414

15+
from socketsecurity import USER_AGENT_NAME
1516
from socketsecurity.config import CliConfig, truncate_commit_message
1617
from socketsecurity.core import Core
1718
from socketsecurity.core.classes import Diff
@@ -240,7 +241,7 @@ def apply_git_context(config: CliConfig) -> Tuple[bool, Optional[Git]]:
240241

241242

242243
def build_socket_sdk(config: CliConfig) -> socketdev:
243-
cli_user_agent_string = f"SocketPythonCLI/{config.version}"
244+
cli_user_agent_string = f"{USER_AGENT_NAME}/{config.version}"
244245
return socketdev(
245246
token=config.api_token,
246247
timeout=get_api_request_timeout(config),

0 commit comments

Comments
 (0)