Skip to content

Commit

Permalink
add file
Browse files Browse the repository at this point in the history
  • Loading branch information
wilslee committed Jul 5, 2017
1 parent 0f24dc4 commit 39ca354
Show file tree
Hide file tree
Showing 63 changed files with 5,754 additions and 1 deletion.
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,12 @@
# aliyun-sms
阿里云通信的 Python SDK
原阿里云通信的 Python SDK 是 Python2 版本

在公司使用中,项目是用 Python3, 使用 python-future 改造为 Python3版本


###

cd aliyun-sms/api_sdk/
# 按照阿里云官方教程安装其SDK
# 发送短信可以直接引用services的里的send_sms

6 changes: 6 additions & 0 deletions aliyun-sms/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
parent_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, parent_dir)
Binary file added aliyun-sms/api_sdk/.DS_Store
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions aliyun-sms/api_sdk/aliyun-python-sdk-core/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
recursive-include aliyunsdkcore *.xml
18 changes: 18 additions & 0 deletions aliyun-sms/api_sdk/aliyun-python-sdk-core/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
======================
aliyun-python-sdk-core
======================


This is the core module of Aliyun Python SDK.

Aliyun Python SDK is the official software development kit. It makes things easy to integrate your Python application,
library, or script with Aliyun services.

This module works on Python versions:

* 2.6.5 and greater


Documentation:

Please visit http://develop.aliyun.com/sdk/python
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
__author__ = 'alex jiang'
__version__ = '2.3.1'
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__author__='alex jiang'
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

#coding=utf-8

"""
Acs ERROR CODE module.
Created on 6/15/2015
@author: alex jiang
"""

SDK_INVALID_REGION_ID = 'SDK.InvalidRegionId'
SDK_SERVER_UNREACHABLE = 'SDK.ServerUnreachable'
SDK_INVALID_REQUEST = 'SDK.InvalidRequest'
SDK_MISSING_ENDPOINTS_FILER = 'SDK.MissingEndpointsFiler'
SDK_UNKNOWN_SERVER_ERROR = 'SDK.UnknownServerError'
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

#coding=utf-8

"""
Acs error message module.
Created on 6/15/2015
@author: alex jiang
"""

__dict = dict(SDK_INVALID_REGION_ID='Can not find endpoint to access.',
SDK_SERVER_UNREACHABLE='Unable to connect server',
SDK_INVALID_REQUEST='The request is not a valid AcsRequest.',
SDK_MISSING_ENDPOINTS_FILER='Internal endpoints info is missing.',
SDK_UNKNOWN_SERVER_ERROR="Can not parse error message from server response.")


def get_msg(code):
return __dict.get(code)
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

#coding=utf-8

"""
SDK exception error type module.
Created on 6/15/2015
@author: alex
"""

ERROR_TYPE_CLIENT = 'Client'
ERROR_TYPE_SERVER = 'Server'
ERROR_TYPE_THROTTLING = 'Throttling'
ERROR_TYPE_UNKNOWN = 'Unknown'
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

#coding=utf-8

"""
SDK exception module.
Created on 6/15/2015
@author: alex jiang
"""
from __future__ import absolute_import

from builtins import str
from . import error_type


class ClientException(Exception):
"""client exception"""

def __init__(self, code, msg):
"""
:param code: error code
:param message: error message
:return:
"""
Exception.__init__(self)
self.__error_type = error_type.ERROR_TYPE_CLIENT
self.message = msg
self.error_code = code

def __str__(self):
return "%s %s" % (
self.error_code,
self.message,
)

def set_error_code(self, code):
self.error_code = code

def set_error_msg(self, msg):
self.message = msg

def get_error_type(self):
return self.__error_type

def get_error_code(self):
return self.error_code

def get_error_msg(self):
return self.message


class ServerException(Exception):
"""
server exception
"""

def __init__(self, code, msg, http_status=None, request_id=None):
Exception.__init__(self)
self.error_code = code
self.message = msg
self.__error_type = error_type.ERROR_TYPE_SERVER
self.http_status = http_status
self.request_id = request_id

def __str__(self):
return "HTTP Status: %s Error:%s %s RequestID: %s" % (
str(self.http_status),
self.error_code,
self.message,
self.request_id
)

def set_error_code(self, code):
self.error_code = code

def set_error_msg(self, msg):
self.message = msg

def get_error_type(self):
return self.__error_type

def get_error_code(self):
return self.error_code

def get_error_msg(self):
return self.message

def get_http_status(self):
return self.http_status

def get_request_id(self):
return self.request_id

Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

#coding=utf-8

"""
SDK exception module.

Created on 6/15/2015

@author: alex jiang
"""

import error_type


class ClientException(Exception):
"""client exception"""

def __init__(self, code, msg):
"""

:param code: error code
:param message: error message
:return:
"""
Exception.__init__(self)
self.__error_type = error_type.ERROR_TYPE_CLIENT
self.message = msg
self.error_code = code

def __str__(self):
return "%s %s" % (
self.error_code,
self.message,
)

def set_error_code(self, code):
self.error_code = code

def set_error_msg(self, msg):
self.message = msg

def get_error_type(self):
return self.__error_type

def get_error_code(self):
return self.error_code

def get_error_msg(self):
return self.message


class ServerException(Exception):
"""
server exception
"""

def __init__(self, code, msg, http_status=None, request_id=None):
Exception.__init__(self)
self.error_code = code
self.message = msg
self.__error_type = error_type.ERROR_TYPE_SERVER
self.http_status = http_status
self.request_id = request_id

def __str__(self):
return "HTTP Status: %s Error:%s %s RequestID: %s" % (
str(self.http_status),
self.error_code,
self.message,
self.request_id
)

def set_error_code(self, code):
self.error_code = code

def set_error_msg(self, msg):
self.message = msg

def get_error_type(self):
return self.__error_type

def get_error_code(self):
return self.error_code

def get_error_msg(self):
return self.message

def get_http_status(self):
return self.http_status

def get_request_id(self):
return self.request_id

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__author__='alex jiang'
Loading

0 comments on commit 39ca354

Please sign in to comment.