Skip to main content

This repository allows you to access QingCloud and control your resources from your applications.

This SDK is licensed under Apache Licence, Version 2.0.

Installation

Install via pip

$ pip install qingcloud-sdk

Upgrade to the latest version

$ pip install --upgrade qingcloud-sdk

Install from source

git clone https://github.com/yunify/qingcloud-sdk-python.git
cd qingcloud-sdk-python
python setup.py install

Getting Started

In order to operate QingCloud IaaS or QingStor (QingCloud Object Storage), you need apply access key on qingcloud console first.

QingCloud IaaS API

  1. Pass access key id and secret key into method connect_to_zone to create connection

    >>> import qingcloud.iaas
    >>> conn = qingcloud.iaas.connect_to_zone(
            'zone id',
            'access key id',
            'secret access key'
        )
  2. Call API by using IAM role

If you would like to call our APIs without access key and secret key (bad things would happen if they were lost or leaked) or if you want a finer access control over your instances, there is a easy way to do it :P

  • Go to our IAM service, create an instance role and attach it to your instance.

  • Create connection without access key and secret key.

    >>> import qingcloud.iaas
    >>> conn = qingcloud.iaas.connect_to_zone(
          'zone id',
           None,
           None
        )

The variable conn is the instance of qingcloud.iaas.connection.APIConnection, we can use it to call resource related methods. Example:

# launch instances
>>> ret = conn.run_instances(
        image_id='img-xxxxxxxx',
        cpu=1,
        memory=1024,
        vxnets=['vxnet-0'],
        login_mode='passwd',
        login_passwd='Passw0rd@()'
    )

# stop instances
>>> ret = conn.stop_instances(
        instances=['i-xxxxxxxx'],
        force=True
      )

# describe instances
>>> ret = conn.describe_instances(
        status=['running', 'stopped']
      )

QingCloud QingStor API

Pass access key id and secret key into method connect to create connection

>>> import qingcloud.qingstor
>>> conn = qingcloud.qingstor.connect(
        'pek3a.qingstor.com',
        'access key id',
        'secret access key'
    )

The variable conn is the instance of qingcloud.qingstor.connection.QSConnection, we can use it to create Bucket which is used for generating Key and MultiPartUpload.

Example:

# Create a bucket
>>> bucket = conn.create_bucket('mybucket')

# Create a key
>>> key = bucket.new_key('myobject')
>>> with open('/tmp/myfile') as f:
>>>     key.send_file(f)

# Delete the key
>>> bucket.delete_key('myobject')

Coreshub AICP API

Pass access key id and secret key into method connect to create connection

>>> import qingcloud.qai
>>> conn = qingcloud.qai.connect(
        'access key id',
        'secret access key',
        'zone_id'
    )

The variable conn is the instance of qingcloud.qai.connection.QAIConnection, we can use it to connect to aicp server.

Example:

# Get user information.
>>> user_info = conn.get_user_info()

# Get trains.
>>> trains = conn.get_trains()

# Get the metrics of trains.
>>> conn.trains_metrics(['tn-xxx', 'tn-xxx'])

Release files for qingcloud-sdk 1.2.16

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for qingcloud-sdk 1.2.16
File Size Uploaded
qingcloud-sdk-1.2.16.tar.gz 64.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for qingcloud-sdk 1.2.16
File Interpreter ABI Platform
qingcloud_sdk-1.2.16-py2-none-any.whl Python 2 none any Details

Total release size: 168.5 kB

Release files / qingcloud-sdk-1.2.16.tar.gz

Download URL qingcloud-sdk-1.2.16.tar.gz
Size 64.8 kB
Tags Source
SHA-256 checksum
How to use checksums
6fa6a28d1512b48855eb6b04b4e025fd701d21ae474d40b9ff34846ae0a369d9
BLAKE2b-256 checksum
How to use checksums
f855f96af56402640641550a12aa39e681c8e6fd1f9eb492d9dca1a0f2d1d46c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.8.3 requests/2.27.1 setuptools/44.0.0.post20200106 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/2.7.18

Release files / qingcloud_sdk-1.2.16-py2-none-any.whl

Download URL qingcloud_sdk-1.2.16-py2-none-any.whl
Size 103.8 kB
Tags Python 2
SHA-256 checksum
How to use checksums
61240e4e56995a428438941a878c962a776bef0c916a4727f600aa8134d62081
BLAKE2b-256 checksum
How to use checksums
bb180f17377a592581b096c244004f40977bacef25de007bb695a45b5b3dcfea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.8.3 requests/2.27.1 setuptools/44.0.0.post20200106 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/2.7.18

Release history Release notifications | RSS feed

This release

1.2.16 This release

2 release files

1.2.15

2 release files

1.2.14

2 release files

1.2.13

2 release files

1.2.12

2 release files

1.2.10

2 release files

1.2.9

2 release files

1.2.8

2 release files

1.2.7

2 release files

1.2.6

2 release files

1.2.5

2 release files

1.2.4

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2

1 release file

1.1.1

1 release file

1.1

1 release file

1.0.17

1 release file

1.0.16

1 release file

1.0.15

1 release file

1.0.14

1 release file

1.0.13

1 release file

1.0.12

1.0.11

1 release file

1.0.10

1 release file

1.0.9

1 release file

1.0.8

1 release file

1.0.7

1 release file

1.0.6

1 release file

1.0.5

1 release file

1.0.4

1 release file

1.0.3

1 release file

1.0.2

1 release file

1.0.1

1 release file

1.0.0

1 release file

0.9.9

1 release file

0.9.8

1 release file

0.9.7

1 release file

0.9.6

1 release file

0.9.5

1 release file

0.9.4

1 release file

0.9.3

1 release file

0.9.2

1 release file

0.9.1

1 release file

0.9.0

1 release file

0.8.9

1 release file

0.8.8

1 release file

0.8.7

1 release file

0.8.6

1 release file

0.8.5

1 release file

0.8.4

1 release file

0.8.3

1 release file

0.8.2

1 release file

0.8.1

1 release file

0.8

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page