You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
954 B
41 lines
954 B
#! /usr/bin/env python
|
|
# -*- coding: utf-8 -*-
|
|
# Date: 2018/9/18
|
|
|
|
|
|
class BaseAliYunAPI(object):
|
|
"""
|
|
|
|
阿里云服务API基类
|
|
|
|
"""
|
|
|
|
def __init__(self, client=None):
|
|
self._client = client
|
|
|
|
def _get(self, action, **kwargs):
|
|
if hasattr(self, "API_BASE_URL"):
|
|
kwargs['api_base_url'] = getattr(self, "API_BASE_URL")
|
|
|
|
if hasattr(self, "VERSION"):
|
|
kwargs["version"] = getattr(self, "VERSION")
|
|
|
|
return self._client.get(action, **kwargs)
|
|
|
|
def _post(self, action, **kwargs):
|
|
|
|
if hasattr(self, "API_BASE_URL"):
|
|
kwargs['api_base_url'] = getattr(self, "API_BASE_URL")
|
|
|
|
if hasattr(self, "VERSION"):
|
|
kwargs["version"] = getattr(self, "VERSION")
|
|
|
|
return self._client.post(action, **kwargs)
|
|
|
|
@property
|
|
def app_id(self):
|
|
return self._client.app_id
|
|
|
|
@property
|
|
def secret_key(self):
|
|
return self._client.secret_key
|
|
|