softlayer-python

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

  • 所有者: softlayer/softlayer-python
  • 平台:
  • 许可证: MIT License
  • 分类:
  • 主题:
  • 喜欢:
    0
      比较:

Github星跟踪图

SoftLayer API Python Client

.. image:: https://travis-ci.org/softlayer/softlayer-python.svg?branch=master
:target: https://travis-ci.org/softlayer/softlayer-python

.. image:: https://landscape.io/github/softlayer/softlayer-python/master/landscape.svg
:target: https://landscape.io/github/softlayer/softlayer-python/master

.. image:: https://badge.fury.io/py/SoftLayer.svg
:target: http://badge.fury.io/py/SoftLayer

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

.. image:: https://build.snapcraft.io/badge/softlayer/softlayer-python.svg
:target: https://build.snapcraft.io/user/softlayer/softlayer-python

This library provides a simple Python client to interact with SoftLayer's XML-RPC API <https://softlayer.github.io/reference/softlayerapi>_.

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
http://softlayer.github.io/softlayer-python/.

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

  • SoftLayer API reference <https://sldn.softlayer.com/reference/softlayerapi>_
  • Object mask information and examples <https://sldn.softlayer.com/article/object-masks>_
  • Code Examples <https://softlayer.github.io/python/>_

Installation

Install via pip:

.. code-block:: bash

$ pip install softlayer

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

.. code-block:: bash

$ 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:

.. code-block:: bash

$ sudo snap install slcli

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 <http://docs.python-requests.org/>_ 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.

Getting Help

Bugs and feature requests about this library should have a GitHub issue <https://github.com/softlayer/softlayer-python/issues>_ 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 softlayer.github.io <https://softlayer.github.io/python/>_

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.

.. code-block:: bash

$ slcli -vvv vs list

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

.. code-block:: python

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.5, 3.6, 3.7, or 3.8.
  • A valid SoftLayer API username and key.
  • A connection to SoftLayer's private network is required to use
    our private network API endpoints.

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 <https://www.python.org/dev/peps/pep-0373/>_ .
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

  • ptable >= 0.9.2
  • click >= 7
  • requests >= 2.20.0
  • prompt_toolkit >= 2
  • pygments >= 2.0.0
  • urllib3 >= 1.24

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

See the bundled LICENSE file for more information.

主要指标

概览
名称与所有者softlayer/softlayer-python
主编程语言Python
编程语言Python (语言数: 2)
平台
许可证MIT License
所有者活动
创建于2010-04-21 20:36:31
推送于2025-06-16 22:29:38
最后一次提交2025-06-16 17:29:34
发布数101
最新版本名称v6.2.6 (发布于 )
第一版名称v1.1 (发布于 2013-01-21 09:52:16)
用户参与
星数150
关注者数35
派生数193
提交数4.8k
已启用问题?
问题数935
打开的问题数20
拉请求数1196
打开的拉请求数0
关闭的拉请求数93
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?