• Stars
    star
    152
  • Rank 244,685 (Top 5 %)
  • Language
    Python
  • License
    MIT License
  • Created over 14 years ago
  • Updated 16 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A set of Python libraries that assist in calling the SoftLayer API.

SoftLayer API Python Client

https://coveralls.io/repos/github/softlayer/softlayer-python/badge.svg?branch=master

This library provides a simple Python client to interact with SoftLayer's XML-RPC API.

A command-line interface is also included and can be used to manage various SoftLayer products and services.

Documentation

Documentation for the Python client is available at Read the Docs .

Additional API documentation can be found on the SoftLayer Development Network:

Installation

Install via pip:

$ pip install softlayer

Or you can install from source. Download source and run:

$ python setup.py install

Another (safer) method of installation is to use the published snap. Snaps are available for any Linux OS running snapd, the service that runs and manage snaps. Snaps are "auto-updating" packages and will not disrupt the current versions of libraries and software packages on your Linux-based system. To learn more, please visit: https://snapcraft.io/

To install the slcli snap:

$ sudo snap install slcli

(or to get the latest release)

$ sudo snap install slcli --edge

The most up-to-date version of this library can be found on the SoftLayer GitHub public repositories at http://github.com/softlayer. For questions regarding the use of this library please post to Stack Overflow at https://stackoverflow.com/ and your posts with β€œSoftLayer” so our team can easily find your post. To report a bug with this library please create an Issue on github.

InsecurePlatformWarning Notice

This library relies on the requests library to make HTTP requests. On Python versions below Python 2.7.9, requests has started emitting a security warning (InsecurePlatformWarning) due to insecurities with creating SSL connections. To resolve this, upgrade to Python 2.7.9+ or follow the instructions here: http://stackoverflow.com/a/29099439.

Basic Usage

Advanced Usage

You can automatically set some parameters via environment variables with by using the SLCLI prefix. For example

$ export SLCLI_VERBOSE=3
$ export SLCLI_FORMAT=json
$ slcli vs list

is equivalent to

$ slcli -vvv --format=json vs list

Getting Help

Bugs and feature requests about this library should have a GitHub issue opened about them.

Issues with the Softlayer API itself should be addressed by opening a ticket.

Examples

A curated list of examples on how to use this library can be found at SLDN

Development

To get started working with this project please read the CONTRIBUTING document.

You can quickly test local changes by running the './slcli' file, which will load the local softlayer-python code instead of the system's softlayer-python codebase.

Debugging

To get the exact API call that this library makes, you can do the following.

For the CLI, just use the -vvv option. If you are using the REST endpoint, this will print out a curl command that you can use, if using XML, this will print the minimal python code to make the request without the softlayer library.

$ slcli -vvv vs list

If you are using the library directly in python, you can do something like this.

import SoftLayer
import logging

class invoices():

    def __init__(self):
        self.client = SoftLayer.Client()
        debugger = SoftLayer.DebugTransport(self.client.transport)
        self.client.transport = debugger

    def main(self):
        mask = "mask[id]"
        account = self.client.call('Account', 'getObject', mask=mask);
        print("AccountID: %s" % account['id'])

    def debug(self):
        for call in self.client.transport.get_last_calls():
            print(self.client.transport.print_reproduceable(call))

if __name__ == "__main__":
    main = example()
    main.main()
    main.debug()

System Requirements

  • Python 3.8, 3.9, or 3.10.
  • A valid SoftLayer API username and key.
  • A connection to SoftLayer's private network is required to use our private network API endpoints.

Python 3.6 Support

As of version 6.0.0 SoftLayer-Python will no longer support python3.6, which is End of Life as of 2022. If you cannot install python 3.8+ for some reason, you will need to use a version of softlayer-python <= 6.0.0

Python 2.7 Support

As of version 5.8.0 SoftLayer-Python will no longer support python2.7, which is End Of Life as of 2020 . If you cannot install python 3.6+ for some reason, you will need to use a version of softlayer-python <= 5.7.2

Python Packages

  • prettytable >= 2.5.0
  • click >= 8.0.4
  • requests >= 2.20.0
  • prompt_toolkit >= 2
  • pygments >= 2.0.0
  • urllib3 >= 1.24
  • rich == 12.3.0

NOTE If ptable (not prettytable) is installed, this will cause issues rendering tables.

Copyright

This software is Copyright (c) 2016-2021 SoftLayer Technologies, Inc.

See the bundled LICENSE file for more information.

More Repositories

1

sl-ember-components

An Ember CLI Addon that provides a variety of UI components.
JavaScript
114
star
2

swftp

An FTP and SFTP interface for OpenStack Object Storage (swift).
Python
57
star
3

softlayer-ruby

http://softlayer.github.io/softlayer-ruby/
Ruby
54
star
4

softlayer-go

SoftLayer API Client for the Go Language
Go
53
star
5

jumpgate

A simple library to make more clouds compatible with OpenStack.
Python
46
star
6

softlayer-api-php-client

A set of PHP libraries that assist in calling the SoftLayer API.
PHP
44
star
7

terraform-provider-softlayer

a Terraform (http://terraform.io) provider for interacting with SoftLayer (https://www.softlayer.com)
Go
40
star
8

ember-style-guide

40
star
9

haproxy-statsd

Python
35
star
10

softlayer-object-storage-php

SoftLayer Object Storage PHP Client
PHP
28
star
11

chef-openstack

These are a concise set of recipes for OpenStack and SoftLayer servers. In addition, the following site provides a getting started guide for OpenStack on SoftLayer.
Ruby
27
star
12

knife-softlayer

Ruby
25
star
13

softlayer-java

SoftLayer API Client for Java
Java
24
star
14

ember-cli-jsdoc

An Ember CLI addon to generate HTML documentation from JSDoc comments in the source code.
JavaScript
21
star
15

softlayer-object-storage-python

SoftLayer Object Storage Python Client
Python
19
star
16

sl-ember-behavior

An Ember CLI Addon that provides the ability to define and enforce behaviors, combining the concepts of whether a user has permission to perform an action and whether that action can currently be performed.
JavaScript
17
star
17

xapi-go

A XAPI (XenServer API) go binding with native interfaces and structs. Still a work in progress, welcoming pull requests.
Go
15
star
18

.NET-REST-Tool

A handy .NET-based REST troubleshooting tool with C# and vb.NET source available.
C#
14
star
19

mq

Go
14
star
20

softlayer.github.io

A collection of SoftLayer API examples in a variety of languages
HTML
13
star
21

sl-ember-store

An Ember CLI Addon to provide a model layer for an Ember application.
JavaScript
12
star
22

softlayer-object-storage-backup

Python
11
star
23

softlayer-api-perl-client

A set of Perl libraries that assist in calling the SoftLayer API.
Perl
11
star
24

softlayer-object-storage-ruby

SoftLayer Object Storage Ruby Client
Ruby
10
star
25

sl-ember-modelize

An Ember CLI Addon that takes a nested Plain Old Javascript Object (POJO) and returns an Ember Object, resolving any keys to "models" by using the Ember resolver and creating new objects of that model type.
JavaScript
9
star
26

softlayer-object-storage-java

SoftLayer Object Storage Java Client
Java
9
star
27

slick

Python
8
star
28

Twitter-Search-Monitor

Python
6
star
29

stratos

A white-label SoftLayer portal
Ruby
6
star
30

sl-ember-test-helpers

An Ember CLI Addon that provides and registers test helpers for use in the testing of your application
JavaScript
6
star
31

sl-ember-translate

An Ember CLI Addon that provides the ability to lookup a dictionary value either through method calls or via a component in your templates.
JavaScript
4
star
32

softlayer-cinder-driver

Python
3
star
33

bluemix-cloudbase-init

Python
3
star
34

softlayer-cli

This repository houses the code that powers the ibmcloud-cli sl command
Go
2
star
35

devops101

A sample project to demo Bluemix Devops capabilities.
HTML
2
star
36

chef-swftp

Ruby
2
star
37

ironic-inventory-integrator

Python
1
star
38

githubio_source

Templates files for generating softlayer.github.io
HTML
1
star
39

kleiber

Python
1
star
40

keystone-pam

C
1
star
41

stack-dev-tools

Python
1
star