Commit 027acc72 authored by 张允禹's avatar 张允禹

fix

parent 83b8d863
...@@ -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:
......
from __future__ import absolute_import
__author__ = 'alex' __author__ = 'alex'
......
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()
...@@ -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)
# 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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment