Skip to content

Commit d79c264

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 5368c08 commit d79c264

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.6.8'
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
@@ -11,6 +11,7 @@
1111
from socketdev import socketdev
1212
from socketdev.fullscans import FullScanParams
1313

14+
from socketsecurity import USER_AGENT_NAME
1415
from socketsecurity.config import CliConfig
1516
from socketsecurity.core import Core
1617
from socketsecurity.core.classes import Diff
@@ -108,7 +109,7 @@ def get_api_request_timeout(config: CliConfig) -> int:
108109

109110

110111
def build_socket_sdk(config: CliConfig) -> socketdev:
111-
cli_user_agent_string = f"SocketPythonCLI/{config.version}"
112+
cli_user_agent_string = f"{USER_AGENT_NAME}/{config.version}"
112113
return socketdev(
113114
token=config.api_token,
114115
timeout=get_api_request_timeout(config),

0 commit comments

Comments
 (0)