-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
63 changed files
with
5,754 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
recursive-include aliyunsdkcore *.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
2 changes: 2 additions & 0 deletions
2
aliyun-sms/api_sdk/aliyun-python-sdk-core/aliyunsdkcore/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
__author__ = 'alex jiang' | ||
__version__ = '2.3.1' |
1 change: 1 addition & 0 deletions
1
aliyun-sms/api_sdk/aliyun-python-sdk-core/aliyunsdkcore/acs_exception/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
__author__='alex jiang' |
34 changes: 34 additions & 0 deletions
34
aliyun-sms/api_sdk/aliyun-python-sdk-core/aliyunsdkcore/acs_exception/error_code.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
38 changes: 38 additions & 0 deletions
38
aliyun-sms/api_sdk/aliyun-python-sdk-core/aliyunsdkcore/acs_exception/error_msg.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
33 changes: 33 additions & 0 deletions
33
aliyun-sms/api_sdk/aliyun-python-sdk-core/aliyunsdkcore/acs_exception/error_type.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
113 changes: 113 additions & 0 deletions
113
aliyun-sms/api_sdk/aliyun-python-sdk-core/aliyunsdkcore/acs_exception/exceptions.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
111 changes: 111 additions & 0 deletions
111
aliyun-sms/api_sdk/aliyun-python-sdk-core/aliyunsdkcore/acs_exception/exceptions.py.bak
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
1 change: 1 addition & 0 deletions
1
aliyun-sms/api_sdk/aliyun-python-sdk-core/aliyunsdkcore/auth/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
__author__='alex jiang' |
Oops, something went wrong.