Registry / http-networking / socketdev

socketdev

JSON →
library3.3.0pypypi✓ verified 83d ago

The Socket Security Python SDK provides an interface to interact with the Socket API for software supply chain security scanning. It allows users to scan packages, retrieve security insights, and manage their Socket account programmatically. The current version is 3.0.32, and it follows an active release cadence with regular updates.

pip install socketdev
INSTALL
IMPORT
SIG · SOCKETDEV
S
socketdev
http-networkingpythonv3.3.0
Install
2.2s avg
Import
Disk
21MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v3.3.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 22.4MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 2.2s · import 0.000s · 23MB
21MB installed
● package 21MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

API
from socketdev import API
from socketdev import SocketSDKClient

Initializes the SocketSDKClient using an API key (preferably from an environment variable) and performs a basic package scan. Demonstrates handling of the returned `ScanPackageResult` object.

import os import socketdev # Ensure you have SOCKET_API_KEY set as an environment variable or pass api_key directly # e.g., os.environ['SOCKET_API_KEY'] = 'your_api_key_here' try: client = socketdev.SocketSDKClient(api_key=os.environ.get('SOCKET_API_KEY', '')) # Example: Scan a package (npm, lodash, v4.17.21) result = client.scan_package( ecosystem="npm", package="lodash", version="4.17.21", options={"allow_insecure_versions": True} ) print(f"Scan status: {result.status}") print(f"Issue count: {result.issues_count}") # Accessing specific issues if available if result.issues: print("First issue type:", result.issues[0].issue_type) except socketdev.exceptions.SocketApiException as e: print(f"API Error: {e.status_code} - {e.message}") except Exception as e: print(f"An unexpected error occurred: {e}")
socket --version
Debug
Known issues
breakingVersion 3.0.0 introduced significant breaking changes. The `scan_package` method's parameters were updated (`package_name` changed to `package`, `package_version` changed to `version`, `package_type` changed to `ecosystem`). Many methods like `get_package_scorecard` and `get_package_advisories` were removed or renamed. Return types for API calls also changed from dictionaries to Pydantic models.
fix
Review the official documentation and migration guide for `socketdev` 3.x. Update method signatures, parameter names, and how return values are accessed (e.g., `result.status` instead of `result['status']`). If upgrading from 2.x, carefully check all API calls.
affects: >=3.0.0
gotchaAuthentication requires an API key, which can be passed directly to the `SocketSDKClient` constructor via the `api_key` argument or read from the `SOCKET_API_KEY` environment variable. Failing to provide a valid key will result in `401 Unauthorized` errors.
fix
Ensure `os.environ['SOCKET_API_KEY']` is set before initializing the client, or explicitly pass `api_key='YOUR_API_KEY'` during client instantiation. Always protect your API key.
affects: All
gotchaThe `scan_package` method takes an `ecosystem` argument (e.g., 'npm', 'pypi', 'composer') instead of a generic 'package_type'. Using an incorrect or unsupported ecosystem will lead to API errors or incorrect scan results.
fix
Refer to the Socket API documentation for the list of supported `ecosystem` values. For Python packages, use `ecosystem='pypi'`.
affects: >=3.0.0
Upgrade
Version history
3.3.0latest on PyPI · released Jun 10, 2026
Audit
Dependencies
httpxrequiredHTTP client for API requests.
pydanticrequiredData validation and settings management.
pydantic-settingsrequiredSettings management, often used for environment variables.
Agent activity
22 hits · last 30 days
node
20
OpenAI (training)
1
Resources
socketdev — pip install socketdev · libregistry