Registry / devops / softlayer

softlayer

JSON →
library6.2.9pypypi✓ verified 82d ago

The `softlayer-python` library provides both a Python API client and a command-line interface (CLI) for interacting with the IBM Cloud SoftLayer API. It abstracts the complexities of the SOAP/REST API, allowing developers to manage SoftLayer resources such as virtual servers, bare metal, storage, and networking. The current version is 6.2.9, and the project maintains an active release cadence with frequent minor updates and bug fixes.

pip install softlayer
INSTALL
IMPORT
SIG · SOFTLAYER
S
softlayer
devopspythonv6.2.9
Install
4.1s avg
Import
831ms
Disk
49MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v6.2.9 · 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.863s · 52.1MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 4.1s · import 0.799s · 53MB
49MB installed
● package 49MB
Code
Verified usage

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

Client
from SoftLayer import Client
import SoftLayer
API
from SoftLayer import API
import SoftLayer
CLI
from SoftLayer import CLI
import SoftLayer

This quickstart demonstrates how to initialize the SoftLayer client using environment variables for authentication and retrieve basic account information. It also shows an example of fetching virtual guests, highlighting the use of 'object masks' which are fundamental for getting detailed API responses.

import SoftLayer import os # SoftLayer API credentials can be set as environment variables (SL_USERNAME, SL_API_KEY) # or passed directly. Environment variables are recommended for security. # SL_ENDPOINT_URL is optional, defaults to 'api.softlayer.com/rest/v3.1' client = SoftLayer.Client( username=os.environ.get('SL_USERNAME', 'YOUR_USERNAME'), api_key=os.environ.get('SL_API_KEY', 'YOUR_API_KEY'), endpoint_url=os.environ.get('SL_ENDPOINT_URL') ) try: # Example: Get the account details account = client['Account'].getObject() print(f"Successfully connected to SoftLayer. Account ID: {account['id']}, Company: {account['companyName']}") # Example: List up to 5 virtual guests (VMs) # Object masks are crucial for retrieving full data mask = 'mask[id, hostname, domain, primaryIpAddress, primaryBackendIpAddress]' vms = client['Account'].getVirtualGuests(mask=mask, limit=5) if vms: print("\nVirtual Guests (first 5):") for vm in vms: print(f"- ID: {vm.get('id')}, Hostname: {vm.get('hostname')}, IP: {vm.get('primaryIpAddress')}") else: print("\nNo virtual guests found.") except SoftLayer.exceptions.SoftLayerAPIError as e: print(f"Error connecting to SoftLayer API: {e}") print("Please ensure your SL_USERNAME and SL_API_KEY environment variables are correct.") except Exception as e: print(f"An unexpected error occurred: {e}")
slcli --version
Debug
Known issues
breakingCDN (Content Delivery Network) commands were removed from the `slcli` (SoftLayer CLI) and the underlying API methods were deprecated.
fix
Migrate any CDN-related automation to use the newer IBM Cloud CDN services or direct API calls if available. The legacy CDN service is no longer supported through this library.
affects: >=6.2.7
breakingThe method for finding a VLAN's datacenter via `Vlan.primaryRouter` was migrated.
fix
If your code relies on `Vlan.primaryRouter` for datacenter information, review the official documentation or changelog for `softlayer-python` version 6.2.7 to understand the new recommended approach. Direct access to `primaryRouter` might lead to incorrect data or errors.
affects: >=6.2.7
gotchaSoftLayer API calls often return only partial data for objects by default. To retrieve full details (e.g., IP addresses, hardware components for a server), you must specify an 'object mask'.
fix
Always include an `mask` parameter in your API calls (e.g., `client['Virtual_Guest'].getObject(id=123, mask='mask[primaryIpAddress, backendIpAddress]')`). Refer to the SoftLayer API documentation for available properties for each service.
affects: All versions
gotchaWhen fetching large lists of objects (e.g., `getAllObjects`), the API often uses pagination. Incomplete results or unexpected behavior can occur if not handled correctly.
fix
Use the `iter_call` or `cf_call` methods provided by the library for iterating over large result sets, which handle pagination automatically. For manual pagination, use `limit` and `offset` parameters.
affects: All versions, partially addressed in 6.2.9 for `cf_call`
gotchaAuthentication can be configured via `~/.softlayer` config file, environment variables (`SL_USERNAME`, `SL_API_KEY`, `SL_ENDPOINT_URL`), or direct arguments to `SoftLayer.Client`.
fix
Understand the order of precedence: direct arguments > config file > environment variables. Ensure only one method is providing credentials to avoid conflicts or unexpected authentication failures. Using environment variables is often the most flexible for scripting.
affects: All versions
Upgrade
Version history
6.2.9latest on PyPI · released Mar 24, 2026
Audit
Dependencies
requestsrequiredUsed for making HTTP requests to the SoftLayer API.
Agent activity
12 hits · last 30 days
node
8
Amazon
1
OpenAI (training)
1
Resources
softlayer — pip install softlayer · libregistry