Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
A
aliyun-python-sdk-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张允禹
aliyun-python-sdk-core
Commits
027acc72
Commit
027acc72
authored
Jun 29, 2017
by
张允禹
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
83b8d863
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
101 additions
and
6 deletions
+101
-6
client.py
aliyunsdkcore/client.py
+1
-1
test_client.py
tests/test_client.py
+1
-1
test_client.py.bak
tests/test_client.py.bak
+34
-0
test_location_service.py
tests/test_location_service.py
+4
-4
test_location_service.py.bak
tests/test_location_service.py.bak
+61
-0
No files found.
aliyunsdkcore/client.py
View file @
027acc72
...
@@ -244,7 +244,7 @@ class AcsClient:
...
@@ -244,7 +244,7 @@ class AcsClient:
ret
=
body
ret
=
body
try
:
try
:
body_obj
=
json
.
loads
(
body
)
body_obj
=
json
.
loads
(
body
.
decode
()
)
request_id
=
body_obj
.
get
(
'RequestId'
)
request_id
=
body_obj
.
get
(
'RequestId'
)
ret
=
body_obj
ret
=
body_obj
except
ValueError
:
except
ValueError
:
...
...
tests/test_client.py
View file @
027acc72
from
__future__
import
absolute_import
__author__
=
'alex'
__author__
=
'alex'
...
...
tests/test_client.py.bak
0 → 100644
View file @
027acc72
from __future__ import absolute_import
__author__ = 'alex'
# import os
# import sys
# parentdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# sys.path.insert(0,parentdir)
# from aliyun-python-sdk-core import client
import pytest
# ak = 'test-ak'
# secret = 'test-secret'
# region = 'test-region'
# agent = 'aliyuncli'
# max_retry_num = 3
# class TestClient:
#
# @pytest.mark.smoke
# def test_client_init(self):
# self#initiate client
# acs_client = client.AcsClient(ak, secret, region)
# assert acs_client
# #set up attributes
# acs_client.set_user_agent(agent)
# acs_client.set_auto_retry(True)
# acs_client.set_max_retry_num(max_retry_num)
# assert acs_client.get_user_agent() == agent
# assert acs_client.get_max_retry_num() == max_retry_num
# assert acs_client.get_access_key() == ak
# assert acs_client.get_access_secret() == secret
# assert acs_client.get_region_id() == region
# assert acs_client.is_auto_retry()
tests/test_location_service.py
View file @
027acc72
...
@@ -34,9 +34,9 @@ location_service.set_location_service_attr(region='cn-beijing',
...
@@ -34,9 +34,9 @@ location_service.set_location_service_attr(region='cn-beijing',
product_name
=
"Location"
,
product_name
=
"Location"
,
domain
=
"location.aliyuncs.com"
)
domain
=
"location.aliyuncs.com"
)
domain
=
location_service
.
find_product_domain
(
client
.
get_region_id
(),
'oss'
)
domain
=
location_service
.
find_product_domain
(
client
.
get_region_id
(),
'oss'
)
print
domain
print
(
domain
)
domain
=
location_service
.
find_product_domain
(
client
.
get_region_id
(),
'oss'
)
domain
=
location_service
.
find_product_domain
(
client
.
get_region_id
(),
'oss'
)
print
domain
print
(
domain
)
class
DescribeRegionsRequest
(
RpcRequest
):
class
DescribeRegionsRequest
(
RpcRequest
):
...
@@ -57,5 +57,5 @@ class DescribeRegionsRequest(RpcRequest):
...
@@ -57,5 +57,5 @@ class DescribeRegionsRequest(RpcRequest):
request
=
DescribeRegionsRequest
()
request
=
DescribeRegionsRequest
()
status
,
headers
,
body
=
client
.
get_response
(
request
)
status
,
headers
,
body
=
client
.
get_response
(
request
)
print
status
print
(
status
)
print
body
print
(
body
)
tests/test_location_service.py.bak
0 → 100644
View file @
027acc72
# 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
import os
import sys
parent_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, parent_dir)
from aliyunsdkcore.client import AcsClient
from aliyunsdkcore.request import RpcRequest
client = AcsClient('your_access_key', 'your_access_secret', 'cn-hangzhou')
location_service = client.get_location_service()
location_service.set_location_service_attr(region='cn-beijing',
product_name="Location",
domain="location.aliyuncs.com")
domain = location_service.find_product_domain(client.get_region_id(), 'oss')
print domain
domain = location_service.find_product_domain(client.get_region_id(), 'oss')
print domain
class DescribeRegionsRequest(RpcRequest):
def __init__(self, OwnerId=None, ResourceOwnerAccount=None,
ResourceOwnerId=None, OwnerAccount=None):
RpcRequest.__init__(
self,
'Ecs',
'2014-05-26',
'DescribeRegions',
'oss')
self.add_query_param('OwnerId', OwnerId)
self.add_query_param('ResourceOwnerAccount', ResourceOwnerAccount)
self.add_query_param('ResourceOwnerId', ResourceOwnerId)
self.add_query_param('OwnerAccount', OwnerAccount)
request = DescribeRegionsRequest()
status, headers, body = client.get_response(request)
print status
print body
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment