Code Monkey home page Code Monkey logo

ksc-sdk-python's Issues

Raised exception when using refresh_caches in python3.6

OS: Fedora 23
Python: 3.6

# my code here
s = get_session()
c = s.create_client(
    "cdn",
    ks_access_key_id=settings.KSYUN_ACCESS_KEY_ID,
    ks_secret_access_key=settings.KSYUN_SECRET_ACCESS_KEY
)
               
datas = {
    keys: [
        {
             "Url": url,
        }
    ]
}
              
res = c.refresh_caches(**datas)

and then a exception occured

Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/home/Work/django/rcms/utils/ksyun.py", line 34, in flush
    res = func(**datas)
  File "/usr/local/pyenv3/lib/python3.6/site-packages/kscore/client.py", line 252, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/usr/local/pyenv3/lib/python3.6/site-packages/kscore/client.py", line 521, in _make_api_call
    operation_model, request_dict)
  File "/usr/local/pyenv3/lib/python3.6/site-packages/kscore/endpoint.py", line 117, in make_request
    return self._send_request(request_dict, operation_model)
  File "/usr/local/pyenv3/lib/python3.6/site-packages/kscore/endpoint.py", line 146, in _send_request
    success_response, exception):
  File "/usr/local/pyenv3/lib/python3.6/site-packages/kscore/endpoint.py", line 219, in _needs_retry
    caught_exception=caught_exception)
  File "/usr/local/pyenv3/lib/python3.6/site-packages/kscore/hooks.py", line 226, in emit
    return self._emit(event_name, kwargs)
  File "/usr/local/pyenv3/lib/python3.6/site-packages/kscore/hooks.py", line 209, in _emit
    response = handler(**kwargs)
  File "/usr/local/pyenv3/lib/python3.6/site-packages/kscore/retryhandler.py", line 183, in __call__
    if self._checker(attempts, response, caught_exception):
  File "/usr/local/pyenv3/lib/python3.6/site-packages/kscore/retryhandler.py", line 250, in __call__
    caught_exception)
  File "/usr/local/pyenv3/lib/python3.6/site-packages/kscore/retryhandler.py", line 265, in _should_retry
    return self._checker(attempt_number, response, caught_exception)
  File "/usr/local/pyenv3/lib/python3.6/site-packages/kscore/retryhandler.py", line 313, in __call__
    caught_exception)
  File "/usr/local/pyenv3/lib/python3.6/site-packages/kscore/retryhandler.py", line 222, in __call__
    return self._check_caught_exception(attempt_number, caught_exception)
  File "/usr/local/pyenv3/lib/python3.6/site-packages/kscore/retryhandler.py", line 355, in _check_caught_exception
    raise caught_exception
  File "/usr/local/pyenv3/lib/python3.6/site-packages/kscore/endpoint.py", line 174, in _get_response
    proxies=self.proxies, timeout=self.timeout)
  File "/usr/local/pyenv3/lib/python3.6/site-packages/kscore/vendored/requests/sessions.py", line 573, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/pyenv3/lib/python3.6/site-packages/kscore/vendored/requests/adapters.py", line 370, in send
    timeout=timeout
  File "/usr/local/pyenv3/lib/python3.6/site-packages/kscore/vendored/requests/packages/urllib3/connectionpool.py", line 544, in urlopen
    body=body, headers=headers)
  File "/usr/local/pyenv3/lib/python3.6/site-packages/kscore/vendored/requests/packages/urllib3/connectionpool.py", line 349, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/local/pyenv3/lib/python3.6/http/client.py", line 1239, in request
    self._send_request(method, url, body, headers, encode_chunked)
TypeError: _send_request() takes 5 positional arguments but 6 were given

I watched your code, looks like you not overwrite _send_request right, because in http/client.py (python3.6)

def _send_request(self, method, url, body, headers, encode_chunked):

But in ksrequest.py

def _send_request(self, method, url, body, headers):

In python3.4 http/client.py

def _send_request(self, method, url, body, headers):

I hope you guys can make code compatible between 3.4 and 3.6, because your authorization document looks horrible for me, and I don't want to see them.

Confused by API method mapping

In REST API doc, the pattern of method name is: CAMEL, but SNAKE in Python SDK, unified pattern will more friendly for developers.

克隆 sdk 源码调试失败

1.克隆源码并在源码目录下创建调试文件,提示错误。调试文件可以用 wheel 包正常使用

Traceback (most recent call last):
  File "/Users/kasumiyamoto/Documents/ksc-sdk-python/get_config.py", line 72, in <module>
    cluster = kce_cluster(ksc_service=input_service, ksc_region=ksc_regions[input_region])
  File "/Users/kasumiyamoto/Documents/ksc-sdk-python/get_config.py", line 27, in __init__
    self.kce_cluster = get_session().create_client(service_name=self.ksc_service,
  File "/Users/kasumiyamoto/Documents/ksc-sdk-python/kscore/session.py", line 840, in create_client
    client = client_creator.create_client(
  File "/Users/kasumiyamoto/Documents/ksc-sdk-python/kscore/client.py", line 65, in create_client
    client_args = self._get_client_args(customer_model, service_model, region_name, is_secure, endpoint_url,
  File "/Users/kasumiyamoto/Documents/ksc-sdk-python/kscore/client.py", line 217, in _get_client_args
    endpoint = endpoint_creator.create_endpoint(
  File "/Users/kasumiyamoto/Documents/ksc-sdk-python/kscore/endpoint.py", line 240, in create_endpoint
    raise ValueError("Invalid endpoint: %s" % endpoint_url)
ValueError: Invalid endpoint: http://kce."api.ksyun.com"

添加云物理机失败

创建云物理机参数

dddd = {'LineId': '5fc2595f-1bfd-481b-bf64-2d08f116d800',
                'SecurityGroupId.1': '5025f56axxxx', 'ChargeType': 'Daily',
                'SubnetId': '0ef2c6dcxxxxxx', 'AvailabilityZone': 'cn-beijing-6',
                'HostType': 'DB-I', 'ImageId': '3eecbe68-1bc6-45c0-88ed-8434ccb7b83b', 'NetworkInterfaceMode': 'bond4',
                'Password': '1521wjx7&'
}
client=session.create_client(service_name=ksc_service,region_name=ksc_region,ks_access_key_id=ACCESS_KEY,ks_secret_access_key=SECURITY_KEY)
epc_results=client.create_epc(**dddd)

执行以上脚本报错:

kscore.exceptions.ClientError: An error occurred (400001) when calling the CreateEpc operation: Price system-Invalid az param

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.