Skip to main content
###Ucloud Python SDK and Command-Line Tool

#####this is a python sdk for ucloud,as well as a CLI tools for ucloud in linux bash env.

####1. sdk usage:


from ucloud-python-sdk import client as uclient
cl=uclient(base_url, public_key, private_key)
print cl.uhost.get(region="cnnorth-03",uhostids="uhost-4dmzop")

output:
{u'Action': u'DescribeUHostInstanceResponse', u'TotalCount': 1, u'RetCode': 0,
u'UHostSet': [{u'Remark': u'', u'Tag': u'Default', u'Name': u'yan-1',
u'State': u'Running', u'IPSet': [{u'IP': u'10.11.1.126', u'Type': u'Private'},
{u'IPId': u'eip-yci4qr', u'IP': u'107.150.97.103', u'Bandwidth': 2,
u'Type': u'International'}], u'DiskSet': [{u'Type': u'Boot',
u'Drive': u'/dev/sda', u'DiskId': u'ce3b1751-d837-4949-9c73-29368b7fe820',
u'Size': 20}], u'CPU': 1, u'OsName': u'Ubuntu 14.04 64\u4f4d',
u'BasicImageId': u'uimage-nhwrqn',
u'ImageId': u'ce3b1751-d837-4949-9c73-29368b7fe820', u'ExpireTime': 1429632272,
u'UHostType': u'Normal', u'UHostId': u'uhost-4dmzop', u'NetworkState': u'Connected',
u'ChargeType': u'Month', u'Memory': 2048, u'OsType': u'Linux', u'CreateTime': 1426953872,
u'BasicImageName': u'Ubuntu 14.04 64\u4f4d'}]}



####2. command-line usage:
使用之前,先编辑下uclud.rc文件,然后导入环境变量,接下来的命令就不用输入你的认证信息了.

hyphendeMacBook-Air:ucloud-python-sdk hyphen$ cat ucloud.rc
export UCLOUD_REGION="cn-north-03"
export UCLOUD_URL="https://api.ucloud.cn"
export UCLOUD_PUBKEY="asdf"
export UCLOUD_PRIKEY="asdf"

hyphendeMacBook-Air:ucloud-python-sdk hyphen$ source ucloud.rc

hyphendeMacBook-Air:ucloud-python-sdk hyphen$ python shell.py
usage: ucloud [--debug] [--timings] <subcommand> ...

Command line interface for ucloud

Positional arguments:
<subcommand>
uhost-create boot a host
uhost-image-list
list all images
uhost-list list uhosts
uhost-show show a uhost
bash-completion
Prints all of the commands and options to stdout so that
the ucloud.bash_completion script doesn't have to hard
code them.
help Display help about this program or one of its subcommands.

Optional arguments:
--debug Print debugging output
--timings Print call timing info

See "ucloud help COMMAND" for help on a specific command.



hyphendeMacBook-Air:ucloud-python-sdk hyphen$ python shell.py uhost-show --uhostid uhost-4dmzop
+----------------+------------------------------------------------------------------+
| Property | Value |
+----------------+------------------------------------------------------------------+
| BasicImageId | uimage-nhwrqn |
| BasicImageName | Ubuntu 14.04 64位 |
| CPU | 1 |
| ChargeType | Month |
| CreateTime | 2015-03-22 00:04:32 |
| Disk_0 | /dev/sda 20GB Type:Boot ID:ce3b1751-d837-4949-9c73-29368b7fe820 |
| ExpireTime | 2015-04-22 00:04:32 |
| IP_0 | Private 10.11.1.126 |
| IP_1 | International 2Mb/s 107.150.97.103 ID:eip-yci4qr |
| ImageId | ce3b1751-d837-4949-9c73-29368b7fe820 |
| Memory | 2048 |
| Name | yan-1 |
| NetworkState | Connected |
| OsType | Linux |
| Remark | |
| State | Running |
| Tag | Default |
| UHostId | uhost-4dmzop |
| UHostType | Normal |
+----------------+------------------------------------------------------------------+

Metadata

Release files for ucloud-client 1.0

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

Source distribution (sdist)

Source distribution for ucloud-client 1.0
File Size Uploaded Provenance Actions
ucloud-client-1.0.tar.gz 12.0 kB Without provenance Details for ucloud-client-1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ucloud-client 1.0
File Interpreter ABI Platform Actions
ucloud_client-1.0-py2.7.egg Legacy Egg format - - Details for ucloud_client-1.0-py2.7.egg

Total release size: 44.5 kB

Release files / ucloud-client-1.0.tar.gz

Download URL ucloud-client-1.0.tar.gz
Size 12.0 kB
Tags Source
SHA-256 checksum
How to use checksums
c7cc747d7357111c298d6e4d48b588f7ab9c062646310bb91d102657c2e2dc5d
BLAKE2b-256 checksum
How to use checksums
46318a87247c52e04ef0bfd860c23c1c2238d7bc57bb9b2694bea9de00bd3b74
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / ucloud_client-1.0-py2.7.egg

Download URL ucloud_client-1.0-py2.7.egg
Size 32.5 kB
Tags Egg
SHA-256 checksum
How to use checksums
77955186fe2c610d5a9e56df8bf8485a207801a7af8ace41e44bbf2681342ebd
BLAKE2b-256 checksum
How to use checksums
06527cc169af8e74f4ff6332747e11311062f2181c92033f81b459d9ee37e461
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for ucloud-client 1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0 This release

2 release files No provenance

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