This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Python SDK及客户端

我们提供了方便调用MOS API的Python SDK以及基于该SDK实现的客户端。

安装

使用pip安装

在命令行下可以直接使用pip进行安装:

sudo pip install mosclient

从源码安装

github下载最新版 代码并解压,或者执行如下命令获取源码:

git clone https://github.com/meituan/mcsapi_python.git

进入mcsapi_python目录执行下述命令安装客户端可执行文件climos以及相应的python SDK:

python setup.py install

访问MOS控制台的 API页面 获得API入口URL、ACCESS Key和Secret。

使用Python SDK

通过mosclient.client.Client生成客户端实例,API接口说明实现参见 SDK API文档

示例代码如下:

import mosclient.client

version = '1'
key = 'MOS_ACCESS_KEY'
secret = 'MOS_ACCESS_SECRET'
url = 'https://mosapi.meituan.com/mcs/v1'

cli = mosclient.client.Client(version, key, secret, url)

balance = cli.GetBalance()
print balance

使用Python客户端

安装客户端软件后,执行以下步骤开始使用MOS API Python客户端。

设置环境变量

在MOS控制台 API页面 获取个人的MOS ACCESS Key和Secret,以及API入口URL。设置如下环境变量

export MOS_ACCESS=4ba303cc17454cc7904e044db2a3c912
export MOS_SECRET=2952f821201341a38978ac4a4a292ce8
export MOS_URL=https://mosapi.meituan.com/mcs/v1

执行climos客户端

climos是命令行的客户端工具,用户可以在终端运行,下面的示例是如何使用命令行创建一台机器:

# 输出climos命令行工具帮助信息
> climos help

# 获取当前余额
> climos GetBalance

# 列出所有可用的虚拟机镜像模板,选择一个模板,并记下模板ID,如8e76df8f-3476-4eed-8469-ed22daa1334c (templateID)
> climos DescribeTemplates

# 列出所有可用的虚拟机类型,选择一个类型,并记下类型ID,如C1_M1 (instanceTypeID)
> climos DescribeInstanceTypes

# 创建虚拟机,注意需要帐户中有足够余额
> climos CreateInstance 8e76df8f-3476-4eed-8469-ed22daa1334c C1_M1

更新历史

v1.0.9 (2016-08-04)

  1. 添加RDS一主多从相关接口
  2. 添加ECS(Memcache)相关接口

v1.0.8 (2016-04-27)

  1. 增加后计费主机创建接口兼容
  2. 增加业务组相关API
  3. 支持ip创建备份用户自动开放80端口

v1.0.7 (2016-01-29)

  1. 增加EBS相关API
  2. 增加浮动ip热切换接口
  3. 支持浮动ip的操作用具体ip代替原id

v1.0.6 (2015-09-09)

  1. 增加浮动IP相关API
  2. 创建主机时允许指定区域

v1.0.5 (2015-08-10)

  1. 增加RDS相关api

v1.0.4 (2015-05-13)

  1. 增加Redis缓存API

v1.0.3 (2014-12-19)

  1. 修改SDK创建主机以及修改主机配置时数据盘的单位,由10G修改为1G,与RESTful API的单位统一。 (与之前版本不兼容,升级版本时请注意)

v1.0.2 (2014-10-29)

  1. ChangeInstanceType 支持调整额外的磁盘和带宽
  2. 增加保存和删除模板API

v1.0.1 (2014-08-26)

  1. CreateInstance 支持增加额外的磁盘和带宽

v1.0.0 (2013-10-15)

  1. MCS API第一个版本,完成基本功能
Release History

Release History

1.0.9

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.8

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.7

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.6

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.5

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.3

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
mosclient-1.0.9.tar.gz (28.1 kB) Copy SHA256 Checksum SHA256 Source Aug 24, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting